module ActiveInteractor::Interactor::Context

Interactor context methods. Because {Context} is a module classes should include {Context} rather than inherit from it.

@author Aaron Allen <hello@aaronmallen.me> @since 0.1.0

Attributes

context[RW]

Public Class Methods

new(context = {}) click to toggle source

Initialize a new instance of {Base}

@param context [Hash, Class] attributes to assign to the {Base interactor} instance's

{ActiveInteractor::Context::Base context} instance

@return [Base] a new instance of {Base}

# File lib/active_interactor/interactor/context.rb, line 357
def initialize(context = {})
  @context = self.class.context_class.new(context)
end

Public Instance Methods

finalize_context!() click to toggle source

Mark the {Base interactor} instance as called on the instance's {ActiveInteractor::Context::Base context} instance and return the {ActiveInteractor::Context::Base context} instance.

@since 1.0.0

@return [Class] the {ActiveInteractor::Context::Base context} instance

# File lib/active_interactor/interactor/context.rb, line 367
def finalize_context!
  context.called!(self)
  context.resolve
  context
end