Class: Mutant::Either::Left Private
- Inherits:
-
Mutant::Either
- Object
- Mutant::Either
- Mutant::Either::Left
- Defined in:
- lib/mutant/base.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#apply(&block) ⇒ Either::Left<Object>
private
Evaluate applicative block.
-
#either(left, _right) ⇒ Object
private
Evaluate left side of branch.
-
#fmap(&block) ⇒ Either::Left<Object>
private
Evaluate functor block.
-
#from_left ⇒ Object
private
Unwrap value from left.
-
#from_right ⇒ Object
private
Unwrap value from right.
-
#lmap ⇒ Either::Right<Object>
private
Map over left value.
Methods inherited from Mutant::Either
Instance Method Details
#apply(&block) ⇒ Either::Left<Object>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Evaluate applicative block
99 100 101 |
# File 'lib/mutant/base.rb', line 99 def apply(&block) require_block(&block) end |
#either(left, _right) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Evaluate left side of branch
135 136 137 |
# File 'lib/mutant/base.rb', line 135 def either(left, _right) left.call(value) end |
#fmap(&block) ⇒ Either::Left<Object>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Evaluate functor block
92 93 94 |
# File 'lib/mutant/base.rb', line 92 def fmap(&block) require_block(&block) end |
#from_left ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Unwrap value from left
106 107 108 |
# File 'lib/mutant/base.rb', line 106 def from_left value end |
#from_right ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Unwrap value from right
rubocop:disable Style/GuardClause
115 116 117 118 119 120 121 |
# File 'lib/mutant/base.rb', line 115 def from_right if block_given? yield(value) else fail "Expected right value, got #{inspect}" end end |
#lmap ⇒ Either::Right<Object>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Map over left value
127 128 129 |
# File 'lib/mutant/base.rb', line 127 def lmap Left.new(yield(value)) end |