Module: L43::Core::Result::Constructors
- Included in:
- L43::Core::Result
- Defined in:
- lib/l43/core/result/constructors.rb
Instance Method Summary collapse
Instance Method Details
#error(message, exception: nil, location: nil) ⇒ Object
10 11 12 |
# File 'lib/l43/core/result/constructors.rb', line 10 def error(, exception: nil, location: nil) Failure.new(message:, exception:, location:) end |
#ok(value = None, &blk) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/l43/core/result/constructors.rb', line 14 def ok(value=None, &blk) raise ArgumentError, "ambigous value definition, (&block and positional arg: provided)" if blk && value != None if blk Success.new(blk.()) else Success.new(value) end end |