Class: Depot::Result
- Inherits:
-
Struct
- Object
- Struct
- Depot::Result
- Defined in:
- lib/depot/result.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#ok? ⇒ Object
Returns the value of attribute ok?.
-
#value ⇒ Object
Returns the value of attribute value.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Class Method Summary collapse
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error
4 5 6 |
# File 'lib/depot/result.rb', line 4 def error @error end |
#ok? ⇒ Object
Returns the value of attribute ok?
4 5 6 |
# File 'lib/depot/result.rb', line 4
def ok?
@ok?
end
|
#value ⇒ Object
Returns the value of attribute value
4 5 6 |
# File 'lib/depot/result.rb', line 4 def value @value end |
#warnings ⇒ Object
Returns the value of attribute warnings
4 5 6 |
# File 'lib/depot/result.rb', line 4 def warnings @warnings end |
Class Method Details
.err(error, warnings: []) ⇒ Object
9 10 11 |
# File 'lib/depot/result.rb', line 9 def self.err(error, warnings: []) new(ok?: false, value: nil, warnings:, error:) end |
.ok(value = nil, warnings: []) ⇒ Object
5 6 7 |
# File 'lib/depot/result.rb', line 5 def self.ok(value = nil, warnings: []) new(ok?: true, value:, warnings:, error: nil) end |