Class: AASM::Core::Invokers::LiteralInvoker

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

Overview

Literal invoker which allows to use strings or symbols to call record methods 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



18
19
20
# File 'lib/aasm/core/invokers/literal_invoker.rb', line 18

def invoke_subject
  @result = exec_subject
end

#log_failureObject



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

def log_failure
  failures << subject
end

#may_invoke?Boolean

Returns:

  • (Boolean)


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

def may_invoke?
  subject.is_a?(String) || subject.is_a?(Symbol)
end