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.



79
80
81
82
83
# File 'lib/ruic/statemachine.rb', line 79

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

Instance Method Details

#[](id) ⇒ Object



87
88
89
90
91
# File 'lib/ruic/statemachine.rb', line 87

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

#eachObject



84
85
86
# File 'lib/ruic/statemachine.rb', line 84

def each
	@wrap.xpath('transition').each{ |el| yield @by_el[el] ||= VisualState.new(el) }
end

#lengthObject Also known as: count



92
93
94
# File 'lib/ruic/statemachine.rb', line 92

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