Class: Mutant::Either::Right Private
- Inherits:
-
Mutant::Either
- Object
- Mutant::Either
- Mutant::Either::Right
- Defined in:
- lib/mutant/base.rb
Overview
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.
Left
Instance Method Summary collapse
-
#apply {|value| ... } ⇒ Either<Object>
private
Evaluate applicative block.
-
#either(_left, right) ⇒ Object
private
Evaluate right side of branch.
-
#fmap ⇒ Either::Right<Object>
private
Evaluate functor block.
-
#from_left ⇒ Object
private
Unwrap value from left.
-
#from_right ⇒ Object
private
Unwrap value from right.
-
#lmap(&block) ⇒ Either::Right<Object>
private
Map over left value.
Methods inherited from Mutant::Either
Instance Method Details
#apply {|value| ... } ⇒ Either<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
151 152 153 |
# File 'lib/mutant/base.rb', line 151 def apply yield(value) 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 right side of branch
187 188 189 |
# File 'lib/mutant/base.rb', line 187 def either(_left, right) right.call(value) end |
#fmap ⇒ 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.
Evaluate functor block
144 145 146 |
# File 'lib/mutant/base.rb', line 144 def fmap Right.new(yield(value)) 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
rubocop:disable Style/GuardClause
160 161 162 163 164 165 166 |
# File 'lib/mutant/base.rb', line 160 def from_left if block_given? yield(value) else fail "Expected left value, got #{inspect}" end 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
172 173 174 |
# File 'lib/mutant/base.rb', line 172 def from_right value end |
#lmap(&block) ⇒ 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
179 180 181 |
# File 'lib/mutant/base.rb', line 179 def lmap(&block) require_block(&block) end |