Module: Dry::Monads::RightBiased::Left
- Included in:
- Maybe::None, Dry::Monads::Result::Failure, Try::Error
- Defined in:
- lib/dry/monads/right_biased.rb
Overview
Left/wrong/erroneous part
Class Method Summary collapse
-
.trace_caller ⇒ String
Caller location.
Instance Method Summary collapse
-
#and(_) ⇒ RightBiased::Left
Returns self back.
-
#apply ⇒ RightBiased::Left
Ignores the input parameter and returns self.
-
#bind ⇒ RightBiased::Left
Ignores the input parameter and returns self.
-
#deconstruct ⇒ Object
private
Pattern matching.
-
#discard ⇒ RightBiased::Left
Returns self back.
-
#flatten ⇒ RightBiased::Left
Returns self back.
-
#fmap ⇒ RightBiased::Left
Ignores the input parameter and returns self.
-
#or ⇒ Object
Left-biased #bind version.
-
#or_fmap ⇒ RightBiased::Left, RightBiased::Right
A lifted version of
#or
. -
#tee ⇒ RightBiased::Left
Ignores the input parameter and returns self.
-
#value! ⇒ Object
Raises an error on accessing internal value.
-
#value_or(val = nil) ⇒ Object
Returns the passed value.
Class Method Details
.trace_caller ⇒ String
Returns Caller location.
227 228 229 |
# File 'lib/dry/monads/right_biased.rb', line 227 def self.trace_caller caller_locations(2, 2)[0].to_s end |
Instance Method Details
#and(_) ⇒ RightBiased::Left
Returns self back. It exists to keep the interface identical to that of Right.
322 323 324 |
# File 'lib/dry/monads/right_biased.rb', line 322 def and(_) self end |
#apply ⇒ RightBiased::Left
Ignores the input parameter and returns self. It exists to keep the interface identical to that of Right.
298 299 300 |
# File 'lib/dry/monads/right_biased.rb', line 298 def apply(*) self end |
#bind ⇒ RightBiased::Left
Ignores the input parameter and returns self. It exists to keep the interface identical to that of Right.
240 241 242 |
# File 'lib/dry/monads/right_biased.rb', line 240 def bind(*) self end |
#deconstruct ⇒ 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.
Pattern matching
337 338 339 340 341 342 343 344 345 |
# File 'lib/dry/monads/right_biased.rb', line 337 def deconstruct if Unit.equal?(@value) [] elsif @value.is_a?(::Array) @value else [@value] end end |
#discard ⇒ RightBiased::Left
Returns self back. It exists to keep the interface identical to that of Right.
306 307 308 |
# File 'lib/dry/monads/right_biased.rb', line 306 def discard self end |
#flatten ⇒ RightBiased::Left
Returns self back. It exists to keep the interface identical to that of Right.
314 315 316 |
# File 'lib/dry/monads/right_biased.rb', line 314 def flatten self end |
#fmap ⇒ RightBiased::Left
Ignores the input parameter and returns self. It exists to keep the interface identical to that of Right.
256 257 258 |
# File 'lib/dry/monads/right_biased.rb', line 256 def fmap(*) self end |
#or ⇒ Object
Left-biased #bind version.
268 269 270 |
# File 'lib/dry/monads/right_biased.rb', line 268 def or(*) raise NotImplementedError end |
#or_fmap ⇒ RightBiased::Left, RightBiased::Right
A lifted version of #or
. This is basically #or
+ #fmap
.
279 280 281 |
# File 'lib/dry/monads/right_biased.rb', line 279 def or_fmap(*) raise NotImplementedError end |
#tee ⇒ RightBiased::Left
Ignores the input parameter and returns self. It exists to keep the interface identical to that of Right.
248 249 250 |
# File 'lib/dry/monads/right_biased.rb', line 248 def tee(*) self end |
#value! ⇒ Object
Raises an error on accessing internal value
232 233 234 |
# File 'lib/dry/monads/right_biased.rb', line 232 def value! raise UnwrapError.new(self) end |
#value_or(val = nil) ⇒ Object
Returns the passed value
286 287 288 289 290 291 292 |
# File 'lib/dry/monads/right_biased.rb', line 286 def value_or(val = nil) if block_given? yield else val end end |