Module: FlowMachine::WorkflowState::ClassMethods

Included in:
FlowMachine::WorkflowState
Defined in:
lib/flow_machine/workflow_state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#expose_to_workflow_methodsObject

Returns the value of attribute expose_to_workflow_methods.



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

def expose_to_workflow_methods
  @expose_to_workflow_methods
end

#state_callbacksObject

Returns the value of attribute state_callbacks.



12
13
14
# File 'lib/flow_machine/workflow_state.rb', line 12

def state_callbacks
  @state_callbacks
end

Instance Method Details

#event(name, options = {}, &block) ⇒ Object



26
27
28
29
30
# File 'lib/flow_machine/workflow_state.rb', line 26

def event(name, options = {}, &block)
  define_may_event(name, options)
  define_event(name, options, &block)
  define_event_bang(name)
end

#expose_to_workflow(name) ⇒ Object

Maintains a list of methods that should be exposed to the workflow the workflow is responsible for reading this list



21
22
23
24
# File 'lib/flow_machine/workflow_state.rb', line 21

def expose_to_workflow(name)
  self.expose_to_workflow_methods ||= []
  self.expose_to_workflow_methods << name
end

#state_nameObject



15
16
17
# File 'lib/flow_machine/workflow_state.rb', line 15

def state_name
  name.demodulize.sub(/State\z/, "").underscore.to_sym
end