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



20
21
22
# File 'lib/active_interactor/interactor/context_methods.rb', line 20

def accepts_arguments_matching(set_input_context_class)
  @input_context_class = set_input_context_class
end

#input_context_classObject



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

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

#output_context_classObject



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

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



30
31
32
# File 'lib/active_interactor/interactor/context_methods.rb', line 30

def returns_data_matching(set_output_context_class)
  @output_context_class = set_output_context_class
end

#runtime_context_classObject



36
37
38
39
40
41
42
43
# File 'lib/active_interactor/interactor/context_methods.rb', line 36

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