Class: Zyps::AgeCondition

Inherits:
Condition show all
Defined in:
lib/zyps/conditions.rb

Overview

Select objects older than the given age.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Condition

#copy

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

#ageObject

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