class Stativus::State
Attributes
global_concurrent_state[RW]
has_concurrent_substates[RW]
history[RW]
initial_substate[RW]
local_concurrent_state[RW]
parent_state[RW]
statechart[RW]
states[RW]
substates[RW]
Public Class Methods
global_concurrent_state(state)
click to toggle source
# File lib/stativus.rb, line 63 def self.global_concurrent_state(state) send :define_method, :_global_concurrent_state do return state end end
has_concurrent_substates(value)
click to toggle source
My ruby foo is weak and i really with there was another way to setup data on a class other than calling send :define_method then checking for the existence of this method…
# File lib/stativus.rb, line 57 def self.has_concurrent_substates(value) send :define_method, :_has_concurrent_substates do return value end end
initial_substate(state)
click to toggle source
# File lib/stativus.rb, line 75 def self.initial_substate(state) send :define_method, :_initial_substate do return state end end
new(statechart)
click to toggle source
# File lib/stativus.rb, line 13 def initialize(statechart) @statechart = statechart @substates = [] @has_concurrent_substates = self.respond_to?(:_has_concurrent_substates) ? self._has_concurrent_substates : false @global_concurrent_state = self.respond_to?(:_global_concurrent_state) ? self._global_concurrent_state : DEFAULT_TREE @states = self.respond_to?(:_states) ? self._states : [] @initial_substate = self.respond_to?(:_initial_substate) ? self._initial_substate : nil @parent_state = self.respond_to?(:_parent_state) ? self._parent_state : nil end
parent_state(state)
click to toggle source
# File lib/stativus.rb, line 81 def self.parent_state(state) send :define_method, :_parent_state do return state end end
states(*states)
click to toggle source
# File lib/stativus.rb, line 69 def self.states(*states) send :define_method, :_states do return states end end
Public Instance Methods
goto_history_state(name)
click to toggle source
# File lib/stativus.rb, line 34 def goto_history_state(name) sc = @statechart if(sc) sc.gotoHistroyState(name, @global_concurrent_state, @local_concurrent_state) else raise "State has no statechart. Therefore no History State" end end
goto_state(name)
click to toggle source
# File lib/stativus.rb, line 25 def goto_state(name) sc = @statechart if(sc) sc.goto_state(name, @global_concurrent_state, @local_concurrent_state) else raise "State has no statechart. Therefore no gotoState" end end
name()
click to toggle source
# File lib/stativus.rb, line 87 def name return self.class.to_s end
send_event(evt, *args)
click to toggle source
# File lib/stativus.rb, line 43 def send_event(evt, *args) sc = @statechart if(sc) sc.send_event(evt, args) else raise "can't send event cause state doesn't have a statechart" end end
Also aliased as: send_action
to_s()
click to toggle source
# File lib/stativus.rb, line 91 def to_s return self.class.to_s end