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.



75
76
77
78
79
# File 'lib/ruic/statemachine.rb', line 75

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

Instance Method Details

#[](id) ⇒ Object



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

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

#eachObject



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

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

#lengthObject Also known as: count



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

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