Class: Zyps::TagAction
- Inherits:
-
Action
- Object
- Action
- Zyps::TagAction
- Defined in:
- lib/zyps/actions.rb
Overview
Add a tag to the target.
Instance Attribute Summary collapse
-
#tag ⇒ Object
Tag to apply to targets.
Instance Method Summary collapse
-
#do(actor, targets) ⇒ Object
Apply the given tag to the targets.
-
#initialize(tag) ⇒ TagAction
constructor
A new instance of TagAction.
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
#tag ⇒ Object
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. << tag unless target..include?(tag) end end |