Class: Emu::Err
- Inherits:
-
Object
- Object
- Emu::Err
- Defined in:
- lib/emu/result.rb
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(error) ⇒ Err
constructor
A new instance of Err.
- #then ⇒ Object
- #to_s ⇒ Object
- #unwrap ⇒ Object
- #unwrap_err ⇒ Object
Constructor Details
#initialize(error) ⇒ Err
Returns a new instance of Err.
3 4 5 |
# File 'lib/emu/result.rb', line 3 def initialize(error) @error = error end |
Instance Method Details
#error? ⇒ Boolean
23 24 25 |
# File 'lib/emu/result.rb', line 23 def error? true end |
#then ⇒ Object
11 12 13 |
# File 'lib/emu/result.rb', line 11 def then self end |
#to_s ⇒ Object
7 8 9 |
# File 'lib/emu/result.rb', line 7 def to_s "Err(#{@error})" end |
#unwrap ⇒ Object
15 16 17 |
# File 'lib/emu/result.rb', line 15 def unwrap raise "can't unwrap Err(#{@error.inspect})" end |
#unwrap_err ⇒ Object
19 20 21 |
# File 'lib/emu/result.rb', line 19 def unwrap_err @error end |