Class: UIC::Application::StateMachine::VisualStates
- Inherits:
-
Object
- Object
- UIC::Application::StateMachine::VisualStates
- Includes:
- Enumerable
- Defined in:
- lib/ruic/statemachine.rb
Instance Method Summary collapse
- #[](id) ⇒ Object
- #each ⇒ Object
-
#initialize(app_machine, visuals_el) ⇒ VisualStates
constructor
A new instance of VisualStates.
- #length ⇒ Object (also: #count)
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 |
#each ⇒ Object
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 |
#length ⇒ Object Also known as: count
72 73 74 |
# File 'lib/ruic/statemachine.rb', line 72 def length @wrap.xpath('count(state)').to_i end |