Class: Zyps::TagAction
Overview
Add a tag to the target.
Instance Attribute Summary collapse
-
#tag ⇒ Object
Tag to apply to targets.
Attributes inherited from Action
Instance Method Summary collapse
-
#do(actor, targets) ⇒ Object
Apply the given tag to the targets.
-
#initialize(tag) ⇒ TagAction
constructor
A new instance of TagAction.
Methods inherited from Action
#copy, #start, #started?, #stop
Constructor Details
#initialize(tag) ⇒ TagAction
Returns a new instance of TagAction.
163 164 165 |
# File 'lib/zyps/actions.rb', line 163 def initialize(tag) self.tag = tag end |
Instance Attribute Details
#tag ⇒ Object
Tag to apply to targets.
162 163 164 |
# File 'lib/zyps/actions.rb', line 162 def tag @tag end |
Instance Method Details
#do(actor, targets) ⇒ Object
Apply the given tag to the targets.
167 168 169 170 171 |
# File 'lib/zyps/actions.rb', line 167 def do(actor, targets) targets.each do |target| target. << tag unless target..include?(tag) end end |