Sha256: 77ace6eb7e89932aba49eead9c2fe1494dceb776906bdcedb505213c4780178a
Contents?: true
Size: 767 Bytes
Versions: 5
Compression:
Stored size: 767 Bytes
Contents
module Dry::Monads class Result # @see Monads#Result # @private class Fixed < Module def self.[](error, **options) new(error, **options) end def initialize(error, **options) @mod = Module.new do define_method(:Failure) do |value| if error === value Failure.new(value, RightBiased::Left.trace_caller) else raise InvalidFailureTypeError.new(value) end end def Success(value = Undefined, &block) v = Undefined.default(value, block || Unit) Success.new(v) end end end private def included(base) super base.include(@mod) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems