Class: Zyps::ClassCondition
- Inherits:
-
Condition
- Object
- Condition
- Zyps::ClassCondition
- Defined in:
- lib/zyps/conditions.rb
Overview
True if the actor and target are of the same Ruby class.
Instance Attribute Summary collapse
-
#target_class ⇒ Object
The class of target to look for.
Instance Method Summary collapse
-
#initialize(target_class) ⇒ ClassCondition
constructor
A new instance of ClassCondition.
-
#select(actor, targets) ⇒ Object
Returns an array of targets that are of the selected Ruby class.
Constructor Details
#initialize(target_class) ⇒ ClassCondition
Returns a new instance of ClassCondition.
98 99 100 |
# File 'lib/zyps/conditions.rb', line 98 def initialize(target_class) self.target_class = target_class end |
Instance Attribute Details
#target_class ⇒ Object
The class of target to look for.
97 98 99 |
# File 'lib/zyps/conditions.rb', line 97 def target_class @target_class end |
Instance Method Details
#select(actor, targets) ⇒ Object
Returns an array of targets that are of the selected Ruby class.
102 103 104 |
# File 'lib/zyps/conditions.rb', line 102 def select(actor, targets) targets.grep(target_class) end |