class Interactor::Contracts::Outcome
The outcome of a Terms
enforcement.
Attributes
result[R]
The result of a Terms
enforcement
@api private @return [Dry::Validation::Result]
Public Class Methods
Public Instance Methods
breaches()
click to toggle source
The list of breaches of the Terms
@example
terms = Interactor::Contract::Terms.new terms.add do required(:name).filled end outcome = terms.call(:name => "Bilbo Baggins") outcome.breaches #=> []
@api semipublic @return [Array<Breach>] the breaches of the Terms' constraints
# File lib/interactor/contracts/outcome.rb, line 50 def breaches BreachSet.new(result.errors(full: true).to_h.map do |property, messages| Breach.new(property, messages) end) end
failure?()
click to toggle source
Checks whether the the Terms
enforcement was a failure
@example
terms = Interactor::Contract::Terms.new terms.add do required(:name).filled end outcome = terms.call(:name => "Bilbo Baggins") outcome.failure? #=> false.
@api semipublic @return [Boolean]
# File lib/interactor/contracts/outcome.rb, line 69 def failure? !success? end