Class: Deterministic::Failure
- Inherits:
-
Either
show all
- Defined in:
- lib/deterministic/either/failure.rb
Instance Method Summary
collapse
Methods inherited from Either
#<<, attempt_all, #bind, #failure?, #inspect, #success?, #to_json, #to_s
#match
Methods included from Monad
#==, #bind, #initialize, #join, #map, #to_s, #value
Instance Method Details
#and(other) ⇒ Object
5
6
7
|
# File 'lib/deterministic/either/failure.rb', line 5
def and(other)
self
end
|
#and_then(&block) ⇒ Object
9
10
11
|
# File 'lib/deterministic/either/failure.rb', line 9
def and_then(&block)
self
end
|
#or(other) ⇒ Object
13
14
15
16
|
# File 'lib/deterministic/either/failure.rb', line 13
def or(other)
raise NotMonadError, "Expected #{other.inspect} to be an Either" unless other.is_a? Either
other
end
|
#or_else(&block) ⇒ Object
18
19
20
|
# File 'lib/deterministic/either/failure.rb', line 18
def or_else(&block)
bind(&block)
end
|