Class: AASM::Core::Invokers::ProcInvoker

Inherits:
BaseInvoker show all
Defined in:
lib/aasm/core/invokers/proc_invoker.rb

Overview

Proc invoker which allows to use Procs as state/event/transition callbacks.

Instance Attribute Summary

Attributes inherited from BaseInvoker

#args, #failures, #record, #result, #subject

Instance Method Summary collapse

Methods inherited from BaseInvoker

#initialize, #invoke, #with_failures

Constructor Details

This class inherits a constructor from AASM::Core::Invokers::BaseInvoker

Instance Method Details

#invoke_subjectObject


19
20
21
22
23
24
25
# File 'lib/aasm/core/invokers/proc_invoker.rb', line 19

def invoke_subject
  @result = if support_parameters?
              exec_proc(parameters_to_arity)
            else
              exec_proc(subject.arity)
            end
end

#log_failureObject


14
15
16
17
# File 'lib/aasm/core/invokers/proc_invoker.rb', line 14

def log_failure
  return log_source_location if Method.method_defined?(:source_location)
  log_proc_info
end

#may_invoke?Boolean

Returns:

  • (Boolean)

10
11
12
# File 'lib/aasm/core/invokers/proc_invoker.rb', line 10

def may_invoke?
  subject.is_a?(Proc)
end