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.



89
90
91
# File 'lib/zyps/conditions.rb', line 89

def initialize(target_class)
	self.target_class = target_class
end

Instance Attribute Details

#target_classObject

The class of target to look for.



88
89
90
# File 'lib/zyps/conditions.rb', line 88

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.



93
94
95
# File 'lib/zyps/conditions.rb', line 93

def select(actor, targets)
	targets.grep(target_class)
end