Module: Control::Workflow
- Defined in:
- lib/control/workflow.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#current_state ⇒ Object
Get workflow current state.
-
#enabled ⇒ Boolean
Checks if workflow is enabled.
-
#states ⇒ Array<Class>
Get all state classes associated to this workflow.
-
#transitions ⇒ Array<Transition>
(also: #history)
Get all transitions.
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/control/workflow.rb', line 4 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#current_state ⇒ Object
Get workflow current state
48 49 50 |
# File 'lib/control/workflow.rb', line 48 def current_state transitions.last.to if transitions.last end |
#enabled ⇒ Boolean
Checks if workflow is enabled
28 29 30 |
# File 'lib/control/workflow.rb', line 28 def enabled true end |
#states ⇒ Array<Class>
Get all state classes associated to this workflow
34 35 36 |
# File 'lib/control/workflow.rb', line 34 def states self.class.states end |
#transitions ⇒ Array<Transition> Also known as: history
Get all transitions.
40 41 42 |
# File 'lib/control/workflow.rb', line 40 def transitions Control::Transition.where(:workflow_class => self.class.name, :workflow_id => self.id) end |