Class: Axn::Core::InternalContext

Inherits:
ContextFacade show all
Defined in:
lib/axn/core/context/internal.rb

Overview

Inbound / Internal ContextFacade

Instance Attribute Summary

Attributes inherited from ContextFacade

#declared_fields

Instance Method Summary collapse

Methods inherited from ContextFacade

#fail!, #initialize, #inspect

Constructor Details

This class inherits a constructor from Axn::Core::ContextFacade

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name) ⇒ Object (private)

rubocop:disable Style/MissingRespondToMissing (because we're not actually responding to anything additional)



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/axn/core/context/internal.rb', line 34

def method_missing(method_name, ...) # rubocop:disable Style/MissingRespondToMissing (because we're not actually responding to anything additional)
  if @context.__combined_data.key?(method_name.to_sym)
    msg = <<~MSG
      Method ##{method_name} is not available on Axn::Core::InternalContext!

      #{action_name} may be missing a line like:
        expects :#{method_name}
    MSG

    raise Axn::ContractViolation::MethodNotAllowed, msg
  end

  super
end

Instance Method Details

#default_errorObject



9
# File 'lib/axn/core/context/internal.rb', line 9

def default_error = _msg_resolver(:error, exception: Axn::Failure.new).resolve_default_message

#default_successObject



10
# File 'lib/axn/core/context/internal.rb', line 10

def default_success = _msg_resolver(:success, exception: nil).resolve_default_message