Class: Interactor::Contracts::Outcome
- Inherits:
-
Object
- Object
- Interactor::Contracts::Outcome
- Extended by:
- Forwardable
- Defined in:
- lib/interactor/contracts/outcome.rb
Overview
The outcome of a Terms enforcement.
Instance Method Summary collapse
-
#breaches ⇒ Array<Breach>
The list of breaches of the Terms.
-
#failure? ⇒ Boolean
Checks whether the the Terms enforcement was a failure.
-
#initialize(result) ⇒ Outcome
constructor
private
Instantiates a new Outcome based on the results of a Terms enforcement.
-
#success? ⇒ Boolean
Checks whether the the terms enforcement was a success.
Constructor Details
#initialize(result) ⇒ Outcome
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.
Instantiates a new Outcome based on the results of a Terms enforcement
17 18 19 |
# File 'lib/interactor/contracts/outcome.rb', line 17 def initialize(result) @result = result end |
Instance Method Details
#breaches ⇒ Array<Breach>
The list of breaches of the Terms
50 51 52 53 54 |
# File 'lib/interactor/contracts/outcome.rb', line 50 def breaches BreachSet.new(result.errors(full: true).to_h.map do |property, | Breach.new(property, ) end) end |
#failure? ⇒ Boolean
Checks whether the the Terms enforcement was a failure
69 70 71 |
# File 'lib/interactor/contracts/outcome.rb', line 69 def failure? !success? end |
#success? ⇒ Boolean
Checks whether the the terms enforcement was a success
35 |
# File 'lib/interactor/contracts/outcome.rb', line 35 def_delegator :@result, :success? |