Class: Result::Base
- Inherits:
-
Object
- Object
- Result::Base
- Defined in:
- lib/result/base.rb
Instance Method Summary collapse
- #and_then ⇒ Object
- #error ⇒ Object
- #failure? ⇒ Boolean
-
#initialize(to_wrap) ⇒ Base
constructor
A new instance of Base.
- #on_failure ⇒ Object
- #on_success ⇒ Object
- #or_else ⇒ Object
- #success? ⇒ Boolean
- #value ⇒ Object
Constructor Details
#initialize(to_wrap) ⇒ Base
Returns a new instance of Base.
4 5 6 |
# File 'lib/result/base.rb', line 4 def initialize(to_wrap) @wrapped = to_wrap end |
Instance Method Details
#and_then ⇒ Object
24 25 26 |
# File 'lib/result/base.rb', line 24 def and_then self end |
#error ⇒ Object
20 21 22 |
# File 'lib/result/base.rb', line 20 def error raise "not present" end |
#failure? ⇒ Boolean
12 13 14 |
# File 'lib/result/base.rb', line 12 def failure? false end |
#on_failure ⇒ Object
36 37 38 |
# File 'lib/result/base.rb', line 36 def on_failure self end |
#on_success ⇒ Object
32 33 34 |
# File 'lib/result/base.rb', line 32 def on_success self end |
#or_else ⇒ Object
28 29 30 |
# File 'lib/result/base.rb', line 28 def or_else self end |
#success? ⇒ Boolean
8 9 10 |
# File 'lib/result/base.rb', line 8 def success? false end |
#value ⇒ Object
16 17 18 |
# File 'lib/result/base.rb', line 16 def value raise "not present" end |