Class: Result::Failure
- Inherits:
-
Base
- Object
- Base
- Result::Failure
show all
- Defined in:
- lib/result/failure.rb
Instance Method Summary
collapse
Methods inherited from Base
#and_then, #on_success, #success?, #value
Constructor Details
#initialize(to_wrap) ⇒ Failure
Returns a new instance of Failure.
6
7
8
9
|
# File 'lib/result/failure.rb', line 6
def initialize(to_wrap)
super
freeze
end
|
Instance Method Details
#error ⇒ Object
11
12
13
|
# File 'lib/result/failure.rb', line 11
def error
@wrapped
end
|
#failure? ⇒ Boolean
15
16
17
|
# File 'lib/result/failure.rb', line 15
def failure?
true
end
|
#on_failure {|error| ... } ⇒ Object
23
24
25
26
|
# File 'lib/result/failure.rb', line 23
def on_failure
yield error
super
end
|
#or_else {|error| ... } ⇒ Object
19
20
21
|
# File 'lib/result/failure.rb', line 19
def or_else
yield error
end
|