Class: UIC::Application::StateMachine::VisualTransitions

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ruic/statemachine.rb

Instance Method Summary collapse

Constructor Details

#initialize(app_machine, visuals_el) ⇒ VisualTransitions

Returns a new instance of VisualTransitions.



96
97
98
99
100
# File 'lib/ruic/statemachine.rb', line 96

def initialize(app_machine,visuals_el)
	@machine = app_machine
	@wrap    = visuals_el
	@by_el   = {}
end

Instance Method Details

#[](id) ⇒ Object



104
105
106
107
108
# File 'lib/ruic/statemachine.rb', line 104

def [](id)
	if el=@wrap.at("xmlns:transition[@ref='#{id}']")
		@by_el[el] ||= VisualTransition.new(el,@machine)
	end
end

#eachObject



101
102
103
# File 'lib/ruic/statemachine.rb', line 101

def each
	@wrap.xpath('xmlns:transition').each{ |el| yield @by_el[el] ||= VisualTransition.new(el,@machine) }
end

#lengthObject Also known as: count



109
110
111
# File 'lib/ruic/statemachine.rb', line 109

def length
	@wrap.xpath('count(xmlns:transition)').to_i
end