Module: Control::Workflow::ClassMethods

Defined in:
lib/control/workflow.rb

Instance Method Summary collapse

Instance Method Details

#is_workflow?Boolean

Checks if class is a workflow

Returns:

  • (Boolean)


10
11
12
# File 'lib/control/workflow.rb', line 10

def is_workflow?
  true
end

#statesArray<Class>

Get all state classes associated to this workflow

Returns:

  • (Array<Class>)


16
17
18
19
20
21
22
23
# File 'lib/control/workflow.rb', line 16

def states
  reflect_on_all_associations.each.map do |a|
    klass = Kernel.qualified_const_get(a.class_name.to_s.classify)
    if klass.respond_to?(:is_state?) and klass.is_state?
      klass
    end
  end
end