Class: Zyps::TagAction

Inherits:
Action
  • Object
show all
Defined in:
lib/zyps/actions.rb

Overview

Add a tag to the target.

Instance Attribute Summary collapse

Attributes inherited from Action

#started

Instance Method Summary collapse

Methods inherited from Action

#copy, #start, #started?, #stop

Constructor Details

#initialize(tag) ⇒ TagAction

Returns a new instance of TagAction.



163
164
165
# File 'lib/zyps/actions.rb', line 163

def initialize(tag)
	self.tag = tag
end

Instance Attribute Details

#tagObject

Tag to apply to targets.



162
163
164
# File 'lib/zyps/actions.rb', line 162

def tag
  @tag
end

Instance Method Details

#do(actor, targets) ⇒ Object

Apply the given tag to the targets.



167
168
169
170
171
# File 'lib/zyps/actions.rb', line 167

def do(actor, targets)
	targets.each do |target|
		target.tags << tag unless target.tags.include?(tag)
	end
end