Cuprum

An opinionated implementation of the Command pattern for Ruby applications. Cuprum wraps your business logic in a consistent, object-oriented interface and features status and error management, composability and control flow management.

Class: Cuprum::Result

Parent Namespace
Cuprum
Defined In
lib/cuprum/result.rb

Table Of Contents

Overview

Data object that encapsulates the result of calling a Cuprum command.

Back To Top

Constants

STATUSES

= %i[success failure].freeze

Enumerates the default permitted values for a Result#status.

Back To Top

Constructor

#initialize(value: nil, error: nil, status: nil) => Result

Parameters

Returns

Back To Top

Instance Attributes

#error => Object (readonly)

Returns

#status => Symbol (readonly)

Returns

#value => Object (readonly)

Returns

Back To Top

Instance Methods

#==(other) => Boolean

Compares the other object to the result.

In order to match the result, the object must respond to the #to_h method, and the value of object.to_h must be equal to the value of result.properties.

Parameters

Returns

#failure? => Boolean

Returns

#properties => Hash{Symbol => Object}

Also known as: to_h

Returns

#success? => Boolean

Returns

#to_cuprum_result => Cuprum::Result

Returns

Back To Top


Back to Documentation | Versions | 1.3 | Reference | Cuprum