Class: Apollo::Specification

Inherits:
Object
  • Object
show all
Defined in:
lib/apollo/specification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(meta = {}, &specification)
  @states = Hash.new
  @state_sets = Hash.new
  @meta = meta
  instance_eval(&specification)
end

Instance Attribute Details

#initial_stateObject

Returns the value of attribute initial_state.



3
4
5
# File 'lib/apollo/specification.rb', line 3

def initial_state
  @initial_state
end

#metaObject

Returns the value of attribute meta.



3
4
5
# File 'lib/apollo/specification.rb', line 3

def meta
  @meta
end

#on_transition_procObject

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_setsObject

Returns the value of attribute state_sets.



3
4
5
# File 'lib/apollo/specification.rb', line 3

def state_sets
  @state_sets
end

#statesObject

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