Module: Dry::Monads::Maybe::Mixin::Constructors
- Included in:
- Dry::Monads, Dry::Monads::Maybe::Mixin
- Defined in:
- lib/dry/monads/maybe.rb
Instance Method Summary collapse
- #Maybe(value) ⇒ Maybe::Some, Maybe::None
- #None ⇒ Maybe::None
-
#Some(value = Undefined, &block) ⇒ Object
Some constructor.
Instance Method Details
#Maybe(value) ⇒ Maybe::Some, Maybe::None
305 306 307 |
# File 'lib/dry/monads/maybe.rb', line 305 def Maybe(value) Maybe.coerce(value) end |
#None ⇒ Maybe::None
325 326 327 |
# File 'lib/dry/monads/maybe.rb', line 325 def None None.new(RightBiased::Left.trace_caller) end |
#Some(value) ⇒ Maybe::Some #Some(&block) ⇒ Maybe::Some
Some constructor
319 320 321 322 |
# File 'lib/dry/monads/maybe.rb', line 319 def Some(value = Undefined, &block) v = Undefined.default(value, block || Unit) Some.new(v) end |