Module: ActiveInteractor::Interactor::ContextMethods::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#accepts_arguments_matching(set_input_context_class) ⇒ Object Also known as: input_context, input_type



16
17
18
# File 'lib/active_interactor/interactor/context_methods.rb', line 16

def accepts_arguments_matching(set_input_context_class)
  @input_context_class = set_input_context_class
end

#input_context_classObject



12
13
14
# File 'lib/active_interactor/interactor/context_methods.rb', line 12

def input_context_class
  @input_context_class ||= const_set(:InputContext, Class.new(Context::Input))
end

#output_context_classObject



22
23
24
# File 'lib/active_interactor/interactor/context_methods.rb', line 22

def output_context_class
  @output_context_class ||= const_set(:OutputContext, Class.new(Context::Output))
end

#returns_data_matching(set_output_context_class) ⇒ Object Also known as: output_context, output_type



26
27
28
# File 'lib/active_interactor/interactor/context_methods.rb', line 26

def returns_data_matching(set_output_context_class)
  @output_context_class = set_output_context_class
end

#runtime_context_classObject



32
33
34
35
36
37
38
39
# File 'lib/active_interactor/interactor/context_methods.rb', line 32

def runtime_context_class
  @runtime_context_class ||= begin
    context_class = const_set(:RuntimeContext, Class.new(Context::Runtime))
    context_class.send(:attribute_set).merge(input_context_class.send(:attribute_set).attributes)
    context_class.send(:attribute_set).merge(output_context_class.send(:attribute_set).attributes)
    context_class
  end
end