Module: Workflow::ClassMethods
- Defined in:
- lib/workflow.rb
Instance Attribute Summary collapse
-
#workflow_spec ⇒ Object
readonly
Returns the value of attribute workflow_spec.
Instance Method Summary collapse
- #workflow(&specification) ⇒ Object
-
#workflow_column(column_name = nil) ⇒ Object
Workflow does not provide any state persistence - it is the job of particular persistence libraries for workflow and activerecord or remodel.
Instance Attribute Details
#workflow_spec ⇒ Object (readonly)
Returns the value of attribute workflow_spec.
8 9 10 |
# File 'lib/workflow.rb', line 8 def workflow_spec @workflow_spec end |
Instance Method Details
#workflow(&specification) ⇒ Object
23 24 25 |
# File 'lib/workflow.rb', line 23 def workflow(&specification) assign_workflow Specification.new(Hash.new, &specification) end |
#workflow_column(column_name = nil) ⇒ Object
Workflow does not provide any state persistence - it is the job of particular persistence libraries for workflow and activerecord or remodel. But it still makes sense to provide a default name and override feature.
13 14 15 16 17 18 19 20 21 |
# File 'lib/workflow.rb', line 13 def workflow_column(column_name=nil) if column_name @workflow_state_column_name = column_name.to_sym end if !instance_variable_defined?('@workflow_state_column_name') && superclass.respond_to?(:workflow_column) @workflow_state_column_name = superclass.workflow_column end @workflow_state_column_name ||= :workflow_state end |