Class: Control::Transition

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/control/transition.rb

Instance Method Summary collapse

Instance Method Details

#fromObject

Get source state for transition

Returns:

  • state object



49
50
51
# File 'lib/control/transition.rb', line 49

def from
  Kernel.qualified_const_get(from_class).find(from_id) unless from_class.blank?
end

#toObject

Get destination state for transition

Returns:

  • state object



43
44
45
# File 'lib/control/transition.rb', line 43

def to
  Kernel.qualified_const_get(to_class).find(to_id)
end

#to_sString

Pretty print a transition

Returns:

  • (String)

    transition description: Workflow, from and to states, date



31
32
33
# File 'lib/control/transition.rb', line 31

def to_s
  "Workflow: #{workflow_class} || #{created_at} #{from_class} -> #{to_class}"
end

#workflowObject

Get workflow

Returns:

  • workflow object



37
38
39
# File 'lib/control/transition.rb', line 37

def workflow
  Kernel.qualified_const_get(workflow_class).find(workflow_id)
end