Class: UIC::Application::StateMachine::VisualStates

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

Instance Method Summary collapse

Constructor Details

#initialize(app_machine, visuals_el) ⇒ VisualStates

Returns a new instance of VisualStates.



59
60
61
62
63
# File 'lib/ruic/statemachine.rb', line 59

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

Instance Method Details

#[](id) ⇒ Object



67
68
69
70
71
# File 'lib/ruic/statemachine.rb', line 67

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

#eachObject



64
65
66
# File 'lib/ruic/statemachine.rb', line 64

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

#lengthObject Also known as: count



72
73
74
# File 'lib/ruic/statemachine.rb', line 72

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