Class: Apollo::Specification
- Inherits:
-
Object
- Object
- Apollo::Specification
- Defined in:
- lib/apollo/specification.rb
Instance Attribute Summary collapse
-
#initial_state ⇒ Object
Returns the value of attribute initial_state.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#on_transition_proc ⇒ Object
Returns the value of attribute on_transition_proc.
-
#state_sets ⇒ Object
Returns the value of attribute state_sets.
-
#states ⇒ Object
Returns the value of attribute states.
Instance Method Summary collapse
-
#default_state(state_name = nil) ⇒ Object
TODO - Possibly allow passing of a block here to allow users more control over the default state under certain conditions.
-
#initialize(meta = {}, &specification) ⇒ Specification
constructor
A new instance of Specification.
Constructor Details
#initialize(meta = {}, &specification) ⇒ Specification
Returns a new instance of Specification.
5 6 7 8 9 10 |
# File 'lib/apollo/specification.rb', line 5 def initialize( = {}, &specification) @states = Hash.new @state_sets = Hash.new @meta = instance_eval(&specification) end |
Instance Attribute Details
#initial_state ⇒ Object
Returns the value of attribute initial_state.
3 4 5 |
# File 'lib/apollo/specification.rb', line 3 def initial_state @initial_state end |
#meta ⇒ Object
Returns the value of attribute meta.
3 4 5 |
# File 'lib/apollo/specification.rb', line 3 def @meta end |
#on_transition_proc ⇒ Object
Returns the value of attribute on_transition_proc.
3 4 5 |
# File 'lib/apollo/specification.rb', line 3 def on_transition_proc @on_transition_proc end |
#state_sets ⇒ Object
Returns the value of attribute state_sets.
3 4 5 |
# File 'lib/apollo/specification.rb', line 3 def state_sets @state_sets end |
#states ⇒ Object
Returns the value of attribute states.
3 4 5 |
# File 'lib/apollo/specification.rb', line 3 def states @states end |
Instance Method Details
#default_state(state_name = nil) ⇒ Object
TODO - Possibly allow passing of a block here to allow users more control over the default state under certain conditions
15 16 17 18 19 20 |
# File 'lib/apollo/specification.rb', line 15 def default_state(state_name = nil) return @default_state unless state_name validate_state_name(state_name) @default_state = state_name end |