Module: ActiveInteractor::Interactor::Context::ClassMethods Private

Defined in:
lib/active_interactor/interactor/context.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 0.0.1

API:

  • private

Instance Method Summary collapse

Instance Method Details

#context_attributes(*attributes) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Assign attributes to the context class of the interactor

Examples:

Assign attributes to the context class

class MyInteractor > ActiveInteractor::Base
  context_attributes :first_name, :last_name
end

MyInteractor::Context.attributes
#=> [:first_name, :last_name]

Parameters:

  • the attributes to assign to the context

Since:

  • 0.0.1

API:

  • private



41
42
43
# File 'lib/active_interactor/interactor/context.rb', line 41

def context_attributes(*attributes)
  context_class.attributes = attributes
end

#context_classObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The context class of the interactor

Examples:

class MyInteractor < ActiveInteractor::Base
end

MyInteractor.context_class
#=> MyInteractor::Context

Since:

  • 0.0.1

API:

  • private



53
54
55
# File 'lib/active_interactor/interactor/context.rb', line 53

def context_class
  const_get 'Context'
end

#inherited(base) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create the context class for inherited classes.

Since:

  • 0.0.1

API:

  • private



27
28
29
# File 'lib/active_interactor/interactor/context.rb', line 27

def inherited(base)
  base.const_set 'Context', Class.new(ActiveInteractor::Context::Base)
end