Class: Zyps::TagCondition

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

Overview

Select objects with the correct tag.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag) ⇒ TagCondition

Returns a new instance of TagCondition.



28
29
30
# File 'lib/zyps/conditions.rb', line 28

def initialize(tag)
	self.tag = tag
end

Instance Attribute Details

#tagObject

The tag to look for on the target.



27
28
29
# File 'lib/zyps/conditions.rb', line 27

def tag
  @tag
end

Instance Method Details

#select(actor, targets) ⇒ Object

Returns an array of targets which have the assigned tag.



32
33
34
# File 'lib/zyps/conditions.rb', line 32

def select(actor, targets)
	targets.find_all {|target| target.tags.include?(@tag)}
end