Class: Workarea::TagUpdate
- Inherits:
-
Object
- Object
- Workarea::TagUpdate
- Defined in:
- app/services/workarea/tag_update.rb
Instance Attribute Summary collapse
-
#adds ⇒ Object
Returns the value of attribute adds.
-
#removes ⇒ Object
Returns the value of attribute removes.
Instance Method Summary collapse
- #apply(tags) ⇒ Object
-
#initialize(adds: [], removes: []) ⇒ TagUpdate
constructor
A new instance of TagUpdate.
Constructor Details
#initialize(adds: [], removes: []) ⇒ TagUpdate
Returns a new instance of TagUpdate.
5 6 7 8 |
# File 'app/services/workarea/tag_update.rb', line 5 def initialize(adds: [], removes: []) @adds = adds @removes = removes end |
Instance Attribute Details
#adds ⇒ Object
Returns the value of attribute adds.
3 4 5 |
# File 'app/services/workarea/tag_update.rb', line 3 def adds @adds end |
#removes ⇒ Object
Returns the value of attribute removes.
3 4 5 |
# File 'app/services/workarea/tag_update.rb', line 3 def removes @removes end |
Instance Method Details
#apply(tags) ⇒ Object
10 11 12 13 |
# File 'app/services/workarea/tag_update.rb', line 10 def apply() .reject! { |tag| removes.include?(tag) } .concat(adds).uniq! end |