Class: Zyps::TagAction

Inherits:
Action
  • Object
show all
Defined in:
lib/zyps/actions.rb

Overview

Add a tag to the target.

Instance Attribute Summary collapse

Attributes inherited from Action

#started

Instance Method Summary collapse

Methods inherited from Action

#copy, #start, #started?, #stop

Constructor Details

#initialize(tag) ⇒ TagAction

Returns a new instance of TagAction.



166
167
168
# File 'lib/zyps/actions.rb', line 166

def initialize(tag)
	self.tag = tag
end

Instance Attribute Details

#tagObject

Tag to apply to targets.



165
166
167
# File 'lib/zyps/actions.rb', line 165

def tag
  @tag
end

Instance Method Details

#do(actor, targets) ⇒ Object

Apply the given tag to the targets.



170
171
172
173
174
# File 'lib/zyps/actions.rb', line 170

def do(actor, targets)
	targets.each do |target|
		target.tags << tag unless target.tags.include?(tag)
	end
end