Class: Zyps::TagCondition
- Inherits:
-
Condition
- Object
- Condition
- Zyps::TagCondition
- Defined in:
- lib/zyps/conditions.rb
Overview
Select objects with the correct tag.
Instance Attribute Summary collapse
-
#tag ⇒ Object
The tag to look for on the target.
Instance Method Summary collapse
-
#initialize(tag) ⇒ TagCondition
constructor
A new instance of TagCondition.
-
#select(actor, targets) ⇒ Object
Returns an array of targets which have the assigned tag.
Constructor Details
#initialize(tag) ⇒ TagCondition
Returns a new instance of TagCondition.
28 29 30 |
# File 'lib/zyps/conditions.rb', line 28 def initialize(tag) self.tag = tag end |
Instance Attribute Details
#tag ⇒ Object
The tag to look for on the target.
27 28 29 |
# File 'lib/zyps/conditions.rb', line 27 def tag @tag end |
Instance Method Details
#select(actor, targets) ⇒ Object
Returns an array of targets which have the assigned tag.
32 33 34 |
# File 'lib/zyps/conditions.rb', line 32 def select(actor, targets) targets.find_all {|target| target..include?(@tag)} end |