Class: Workarea::TagUpdate

Inherits:
Object
  • Object
show all
Defined in:
app/services/workarea/tag_update.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#addsObject

Returns the value of attribute adds.



3
4
5
# File 'app/services/workarea/tag_update.rb', line 3

def adds
  @adds
end

#removesObject

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(tags)
  tags.reject! { |tag| removes.include?(tag) }
  tags.concat(adds).uniq!
end