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