Module: Workflow::ClassMethods

Defined in:
lib/workflow.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#workflow_specObject (readonly)

Returns the value of attribute workflow_spec.



16
17
18
# File 'lib/workflow.rb', line 16

def workflow_spec
  @workflow_spec
end

Instance Method Details

#workflow(&specification) ⇒ Object



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

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.



21
22
23
24
25
26
27
28
29
# File 'lib/workflow.rb', line 21

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