Sha256: e19066554f0ecd73bac132378016d23a2c081c7edbb596010ca77574c944b741

Contents?: true

Size: 434 Bytes

Versions: 5

Compression:

Stored size: 434 Bytes

Contents

# frozen_string_literal: true

module Fear
  module PartialFunction
    # @api private
    class Lifted
      # @param pf [Fear::PartialFunction]
      def initialize(pf)
        @pf = pf
      end
      attr_reader :pf
      private :pf

      # @param arg [any]
      # @return [Fear::Option]
      def call(arg)
        Some.new(pf.call_or_else(arg) { return Fear::None })
      end
    end

    private_constant :Lifted
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fear-3.0.0 lib/fear/partial_function/lifted.rb
fear-2.0.1 lib/fear/partial_function/lifted.rb
fear-2.0.0 lib/fear/partial_function/lifted.rb
fear-1.2.0 lib/fear/partial_function/lifted.rb
fear-1.1.0 lib/fear/partial_function/lifted.rb