Sha256: 44a41fcc3baf805590c6f5418ca553ec4252eff72896ef7d55e6b063573281b4
Contents?: true
Size: 624 Bytes
Versions: 1
Compression:
Stored size: 624 Bytes
Contents
module Fear # @api private class PartialFunctionClass include PartialFunction # @param arg [any] # @return [any] Calls this partial function with the given argument when it # is contained in the function domain. # @raise [MatchError] when this partial function is not defined. def call(arg) call_or_else(arg, &PartialFunction::EMPTY) end # @param arg [any] # @yield [arg] if function not defined def call_or_else(arg) if defined_at?(arg) function.call(arg) else yield arg end end end private_constant :PartialFunctionClass end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fear-0.11.0 | lib/fear/partial_function_class.rb |