Class: ActiveInteractor::Interactor::Base

Inherits:
Object
  • Object
show all
Includes:
ContextMethods, InteractionMethods, Type::DeclerationMethods
Defined in:
lib/active_interactor/interactor/base.rb

Constant Summary

Constants included from Type::DeclerationMethods

Type::DeclerationMethods::Boolean

Instance Method Summary collapse

Methods included from InteractionMethods

#interact, #perform, #rollback

Constructor Details

#initialize(input = {}) ⇒ Base

Returns a new instance of Base.



10
11
12
13
# File 'lib/active_interactor/interactor/base.rb', line 10

def initialize(input = {})
  @raw_input = input.dup
  validate_input_and_generate_runtime_context!
end

Instance Method Details

#perform!Object



15
16
17
18
19
20
21
# File 'lib/active_interactor/interactor/base.rb', line 15

def perform!
  with_notification(:perform) do |payload|
    interact
    generate_and_validate_output_context!
    payload[:result] = Result.success(data: output_to_result_context!)
  end
end