Sha256: b691825ee6180e9d8675644f5cd0e37cb2eeef33c5879332698a211528e8a1c9
Contents?: true
Size: 687 Bytes
Versions: 8
Compression:
Stored size: 687 Bytes
Contents
# frozen_string_literal: true module Kind class Result::Failure < Result::Monad DEFAULT_TYPE = :error def failure? true end def value_or(default = UNDEFINED, &block) Error.invalid_default_arg! if UNDEFINED == default && !block UNDEFINED != default ? default : block.call(value) end def map(_ = UNDEFINED, &_fn) self end alias_method :|, :map alias_method :>>, :map alias_method :map!, :map alias_method :then, :map alias_method :then!, :map alias_method :and_then, :map alias_method :and_then!, :map def inspect '#<%s type=%p value=%p>' % ['Kind::Failure', type, value] end end end
Version data entries
8 entries across 8 versions & 1 rubygems