Class: TaliaCore::Workflow::SupportingClasses::State

Inherits:
Object
  • Object
show all
Defined in:
lib/talia_core/workflow.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, opts) ⇒ State

Returns a new instance of State.



19
20
21
# File 'lib/talia_core/workflow.rb', line 19

def initialize(name, opts)
  @name, @opts = name, opts
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#entered(record) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/talia_core/workflow.rb', line 28

def entered(record)
  afteractions = @opts[:after]
  return unless afteractions
  Array(afteractions).each do |afteract|
    record.send(:run_transition_action, afteract)
  end
end

#entering(record) ⇒ Object



23
24
25
26
# File 'lib/talia_core/workflow.rb', line 23

def entering(record)
  enteract = @opts[:enter]
  record.send(:run_transition_action, enteract) if enteract
end

#exited(record) ⇒ Object



36
37
38
39
# File 'lib/talia_core/workflow.rb', line 36

def exited(record)
  exitact  = @opts[:exit]
  record.send(:run_transition_action, exitact) if exitact
end