Class: Zyps::ClassCondition

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

Overview

True if the actor and target are of the same Ruby class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Condition

#copy

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_classObject

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