Class: AASM::Core::Invokers::ClassInvoker

Inherits:
BaseInvoker
  • Object
show all
Defined in:
lib/aasm/core/invokers/class_invoker.rb

Overview

Class invoker which allows to use classes which respond to #call to be used 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
# File 'lib/aasm/core/invokers/class_invoker.rb', line 19

def invoke_subject
  @result = instance.call
end

#log_failureObject



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

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

#may_invoke?Boolean

Returns:

  • (Boolean)


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

def may_invoke?
  subject.is_a?(Class) && subject.instance_methods.include?(:call)
end