Module: Interactor::Contracts

Defined in:
lib/interactor/contracts.rb,
lib/interactor/contracts/dsl.rb,
lib/interactor/contracts/terms.rb,
lib/interactor/contracts/breach.rb,
lib/interactor/contracts/errors.rb,
lib/interactor/contracts/outcome.rb,
lib/interactor/contracts/version.rb,
lib/interactor/contracts/contract.rb,
lib/interactor/contracts/breach_set.rb

Overview

Create a contract for your interactor that specifies what it expects as inputs.

Defined Under Namespace

Modules: DSL Classes: Breach, BreachSet, Contract, Outcome, Terms

Constant Summary collapse

ContractsError =

Base error class used for all errors within the gem.

Class.new(StandardError)
NotAnInteractor =

Raised when trying to include Interactor::Contracts into a class that is not an Interactor.

Class.new(ContractsError)
VERSION =
"0.2.0".freeze

Class Method Summary collapse

Class Method Details

.included(descendant) ⇒ void

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.

This method returns an undefined value.

Called when the module is included into another class or module


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

def self.included(descendant)
  unless descendant.include?(Interactor)
    fail NotAnInteractor, "#{descendant} does not include `Interactor'"
  end
  descendant.extend(DSL)
end