Class: StateManager::State::Specification
- Inherits:
-
Object
- Object
- StateManager::State::Specification
- Defined in:
- lib/state_manager/state.rb
Overview
Represents the static specification of this state. This consists of all child states and events. During initialization, the specification will be read and the child states and events will be initialized.
Instance Attribute Summary collapse
-
#events ⇒ Object
Returns the value of attribute events.
-
#initial_state ⇒ Object
Returns the value of attribute initial_state.
-
#states ⇒ Object
Returns the value of attribute states.
Instance Method Summary collapse
- #descendant_names ⇒ Object
-
#initialize ⇒ Specification
constructor
A new instance of Specification.
- #initialize_copy(source) ⇒ Object
Constructor Details
#initialize ⇒ Specification
Returns a new instance of Specification.
12 13 14 15 |
# File 'lib/state_manager/state.rb', line 12 def initialize self.states = {} self.events = {} end |
Instance Attribute Details
#events ⇒ Object
Returns the value of attribute events.
10 11 12 |
# File 'lib/state_manager/state.rb', line 10 def events @events end |
#initial_state ⇒ Object
Returns the value of attribute initial_state.
10 11 12 |
# File 'lib/state_manager/state.rb', line 10 def initial_state @initial_state end |
#states ⇒ Object
Returns the value of attribute states.
10 11 12 |
# File 'lib/state_manager/state.rb', line 10 def states @states end |
Instance Method Details
#descendant_names ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/state_manager/state.rb', line 22 def descendant_names res = [] states.each do |state, specification_klass| res << state res.concat specification_klass.specification.descendant_names.map{|s| "#{state}.#{s}"} end res end |
#initialize_copy(source) ⇒ Object
17 18 19 20 |
# File 'lib/state_manager/state.rb', line 17 def initialize_copy(source) self.states = source.states.dup self.events = source.events.dup end |