Class: Flows::Result::Err
- Inherits:
-
Flows::Result
- Object
- Flows::Result
- Flows::Result::Err
- Defined in:
- lib/flows/result/err.rb
Overview
Result Object for failure results.
Instance Attribute Summary
Attributes inherited from Flows::Result
Instance Method Summary collapse
- #err? ⇒ true
- #error ⇒ Object
-
#initialize(data, status: :err, meta: {}) ⇒ Err
constructor
A new instance of Err.
- #ok? ⇒ false
- #unwrap ⇒ Object
Methods inherited from Flows::Result
Constructor Details
#initialize(data, status: :err, meta: {}) ⇒ Err
Returns a new instance of Err.
7 8 9 10 11 |
# File 'lib/flows/result/err.rb', line 7 def initialize(data, status: :err, meta: {}) @data = data @status = status @meta = end |
Instance Method Details
#err? ⇒ true
23 24 25 |
# File 'lib/flows/result/err.rb', line 23 def err? true end |
#error ⇒ Object
13 14 15 |
# File 'lib/flows/result/err.rb', line 13 def error @data end |
#ok? ⇒ false
18 19 20 |
# File 'lib/flows/result/err.rb', line 18 def ok? false end |
#unwrap ⇒ Object
27 28 29 |
# File 'lib/flows/result/err.rb', line 27 def unwrap raise AccessError, self end |