Module: ActiveInteractor

Extended by:
ActiveSupport::Autoload
Defined in:
lib/active_interactor.rb,
lib/active_interactor/base.rb,
lib/active_interactor/error.rb,
lib/active_interactor/config.rb,
lib/active_interactor/models.rb,
lib/active_interactor/version.rb,
lib/active_interactor/configurable.rb,
lib/active_interactor/context/base.rb,
lib/active_interactor/rails/railtie.rb,
lib/active_interactor/context/errors.rb,
lib/active_interactor/context/loader.rb,
lib/active_interactor/context/status.rb,
lib/active_interactor/organizer/base.rb,
lib/active_interactor/interactor/worker.rb,
lib/active_interactor/organizer/perform.rb,
lib/active_interactor/context/attributes.rb,
lib/active_interactor/interactor/context.rb,
lib/active_interactor/interactor/perform.rb,
lib/active_interactor/organizer/organize.rb,
lib/active_interactor/organizer/callbacks.rb,
lib/active_interactor/interactor/callbacks.rb,
lib/active_interactor/organizer/interactor_interface.rb,
lib/active_interactor/organizer/interactor_interface_collection.rb

Overview

An interactor is a simple, single-purpose service object. Interactors can be used to reduce the responsibility of your controllers, workers, and models and encapsulate your application's business logic. Each interactor represents one thing that your application does.

Each interactor has it's own immutable context which contains everything the interactor needs to do its work. When an interactor does its single purpose, it affects its given context.

License

Copyright (c) 2019 Aaron Allen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Defined Under Namespace

Modules: Configurable, Context, Error, Interactor, Models, Organizer, Rails, Version Classes: Base, Config

Class Method Summary collapse

Class Method Details

.configConfig

The ActiveInteractor configuration

Returns:

Since:

  • 0.1.0



34
35
36
# File 'lib/active_interactor/config.rb', line 34

def self.config
  @config ||= ActiveInteractor::Config.new
end

.configure {|#config| ... } ⇒ Object

Configure the ActiveInteractor gem

Examples:

Configure ActiveInteractor

require 'active_interactor'
ActiveInteractor.configure do |config|
  config.logger = ::Rails.logger
end

Yields:

Since:

  • 0.1.0



48
49
50
# File 'lib/active_interactor/config.rb', line 48

def self.configure
  yield config
end

.loggerClass

The logger instance to use for logging

Returns:

Since:

  • 0.1.0



57
58
59
# File 'lib/active_interactor/config.rb', line 57

def self.logger
  config.logger
end