Class: Zyps::AgeCondition
- Inherits:
-
Condition
- Object
- Condition
- Zyps::AgeCondition
- Defined in:
- lib/zyps/conditions.rb
Overview
Select objects older than the given age.
Instance Attribute Summary collapse
-
#age ⇒ Object
The minimum age in seconds.
Instance Method Summary collapse
-
#initialize(age) ⇒ AgeCondition
constructor
A new instance of AgeCondition.
-
#select(actor, targets) ⇒ Object
Returns an array of targets which are older than the assigned age.
Constructor Details
#initialize(age) ⇒ AgeCondition
Returns a new instance of AgeCondition.
42 43 44 |
# File 'lib/zyps/conditions.rb', line 42 def initialize(age) self.age = age end |
Instance Attribute Details
#age ⇒ Object
The minimum age in seconds.
41 42 43 |
# File 'lib/zyps/conditions.rb', line 41 def age @age end |
Instance Method Details
#select(actor, targets) ⇒ Object
Returns an array of targets which are older than the assigned age.
46 47 48 |
# File 'lib/zyps/conditions.rb', line 46 def select(actor, targets) targets.find_all {|target| target.age > @age} end |