Class: Workflow::Specification

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(meta = {}, &specification) ⇒ Specification

Returns a new instance of Specification.



15
16
17
18
19
# File 'lib/workflow.rb', line 15

def initialize(meta = {}, &specification)
  @states = Hash.new
  @meta = meta
  instance_eval(&specification)
end

Instance Attribute Details

#initial_stateObject

Returns the value of attribute initial_state.



13
14
15
# File 'lib/workflow.rb', line 13

def initial_state
  @initial_state
end

#metaObject

Returns the value of attribute meta.



13
14
15
# File 'lib/workflow.rb', line 13

def meta
  @meta
end

#on_failed_transition_procObject

Returns the value of attribute on_failed_transition_proc.



13
14
15
# File 'lib/workflow.rb', line 13

def on_failed_transition_proc
  @on_failed_transition_proc
end

#on_transition_procObject

Returns the value of attribute on_transition_proc.



13
14
15
# File 'lib/workflow.rb', line 13

def on_transition_proc
  @on_transition_proc
end

#statesObject

Returns the value of attribute states.



13
14
15
# File 'lib/workflow.rb', line 13

def states
  @states
end

Instance Method Details

#event_namesObject



25
26
27
# File 'lib/workflow.rb', line 25

def event_names
  states.values.map{|e|  e.events.keys }.uniq
end

#state_namesObject



21
22
23
# File 'lib/workflow.rb', line 21

def state_names
  states.keys
end