Sha256: 7a38fc36b63d8a9f4f2ccde8509a82049de8ea6f15c23a752a552f7bb634872e

Contents?: true

Size: 858 Bytes

Versions: 2

Compression:

Stored size: 858 Bytes

Contents

module Fear
  module PartialFunction
    class Guard
      # @api private
      class And < Guard
        # @param c1 [Fear::PartialFunction::Guard]
        # @param c2 [Fear::PartialFunction::Guard]
        def initialize(c1, c2)
          @c1 = c1
          @c2 = c2
        end
        attr_reader :c1, :c2
        private :c1
        private :c2

        # @param other [Fear::PartialFunction::Guard]
        # @return [Fear::PartialFunction::Guard]
        def and(other)
          Guard::And.new(self, other)
        end

        # @param other [Fear::PartialFunction::Guard]
        # @return [Fear::PartialFunction::Guard]
        def or(other)
          Guard::Or.new(self, other)
        end

        # @param arg [any]
        # @return [Boolean]
        def ===(arg)
          (c1 === arg) && (c2 === arg)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fear-1.0.0 lib/fear/partial_function/guard/and.rb
fear-0.11.0 lib/fear/partial_function/guard/and.rb