Module: Dry::Monads::Result::Mixin::Constructors
- Included in:
- Dry::Monads, Dry::Monads::Result::Mixin
- Defined in:
- lib/dry/monads/result.rb
Overview
Value constructors
Instance Method Summary collapse
-
#Failure(value = Undefined, &block) ⇒ Object
Failure constructor.
-
#Success(value = Undefined, &block) ⇒ Object
Success constructor.
Instance Method Details
#Success(value) ⇒ Result::Failure #Success(&block) ⇒ Result::Failure
Failure constructor
347 348 349 350 |
# File 'lib/dry/monads/result.rb', line 347 def Failure(value = Undefined, &block) v = Undefined.default(value, block || Unit) Failure.new(v, RightBiased::Left.trace_caller) end |
#Success(value) ⇒ Result::Success #Success(&block) ⇒ Result::Success
Success constructor
332 333 334 335 |
# File 'lib/dry/monads/result.rb', line 332 def Success(value = Undefined, &block) v = Undefined.default(value, block || Unit) Success.new(v) end |