Class: Gracefully::Failure
- Inherits:
-
Object
- Object
- Gracefully::Failure
- Defined in:
- lib/gracefully/try.rb
Class Method Summary collapse
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(error) ⇒ Failure
constructor
A new instance of Failure.
- #or_else(other) ⇒ Object
Constructor Details
#initialize(error) ⇒ Failure
Returns a new instance of Failure.
57 58 59 |
# File 'lib/gracefully/try.rb', line 57 def initialize(error) @error = error end |
Class Method Details
.with(error) ⇒ Object
53 54 55 |
# File 'lib/gracefully/try.rb', line 53 def self.with(error) new error end |
Instance Method Details
#get ⇒ Object
65 66 67 |
# File 'lib/gracefully/try.rb', line 65 def get raise Error.new('Tried to get the value of a failure', nested: @error) end |
#or_else(other) ⇒ Object
61 62 63 |
# File 'lib/gracefully/try.rb', line 61 def or_else(other) other end |