class Rails::UseCase::Outcome
Attributes
errors[R]
exception[R]
record[R]
success[R]
Public Class Methods
new(success:, errors: nil, record: nil, exception: nil)
click to toggle source
Constructor. @param success [Boolean] Wether the UseCase
was successful. @param errors [Array|nil] ActiveModel::Validations error. @param record [ApplicationRecord|nil] The main record of the use case. @param exception [Rails::UseCase::Error|nil] The error which was raised.
# File lib/rails/use_case/outcome.rb, line 14 def initialize(success:, errors: nil, record: nil, exception: nil) @success = success @errors = errors @record = record @exception = exception end
Public Instance Methods
failed?()
click to toggle source
@return [Boolean] Whether the UseCase
failed.
# File lib/rails/use_case/outcome.rb, line 29 def failed? !@success end
success?()
click to toggle source
@return [Boolean] Whether the UseCase
was successful.
# File lib/rails/use_case/outcome.rb, line 23 def success? @success end