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.



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

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

Instance Method Details

#[](id) ⇒ Object



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

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

#eachObject



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

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

#lengthObject Also known as: count



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

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