Class: Hanami::Interactor::Result
- Inherits:
- Utils::BasicObject
- Defined in:
- gems/gems/hanami-utils-1.3.3/lib/hanami/interactor.rb,
gems/gems/hanami-utils-1.3.8/lib/hanami/interactor.rb
Overview
Result of an operation
Instance Method Summary collapse
-
#error ⇒ nil, String
Returns the first errors collected during an operation.
-
#errors ⇒ Array
Returns all the errors collected during an operation.
-
#fail! ⇒ Object
Forces the status to be a failure.
-
#failure? ⇒ TrueClass, FalseClass
Checks if the current status is not successful.
-
#successful? ⇒ TrueClass, FalseClass
(also: #success?)
Checks if the current status is successful.
Methods inherited from Utils::BasicObject
#class, #inspect, #instance_of?, #is_a?, #kind_of?, #object_id, #pretty_print, #respond_to?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name) ⇒ Object (protected)
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.
Source: | on GitHub
def method_missing(method_name, *) @payload.fetch(method_name) { super } end |
Instance Method Details
#error ⇒ nil, String
Returns the first errors collected during an operation
Source: | on GitHub
def error errors.first end |
#errors ⇒ Array
Returns all the errors collected during an operation
Source: | on GitHub
def errors @errors.dup end |
#fail! ⇒ Object
Forces the status to be a failure
Source: | on GitHub
def fail! @success = false end |
#failure? ⇒ TrueClass, FalseClass
Checks if the current status is not successful
Source: | on GitHub
def failure? !successful? end |
#successful? ⇒ TrueClass, FalseClass Also known as: success?
Checks if the current status is successful
Source: | on GitHub
def successful? @success && errors.empty? end |