Class: Axn::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::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)



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/axn/core/context/internal.rb', line 15

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::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



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

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

#default_successObject



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

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