Sha256: f3dd817ac6672ec2d20b52ddff8274d5cf9b107d50c7e5a77fae5549256ed14d

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

module Vanguard
  class Matcher
    # Abstract base class for binary matcher
    class Binary < self
      include AbstractType, Equalizer.new(:left, :right)

      # Return left
      #
      # @return [Matcher]
      #
      # @api private
      #
      attr_reader :left

      # Return right
      #
      # @return [Matcher]
      #
      # @api private
      #
      attr_reader :right

    private

      # Initialize object
      #
      # @param [Matcher] left
      # @param [Matcher] right
      #
      # @return [undefined]
      #
      # @api private
      #
      def initialize(left, right)
        @left, @right = left, right
      end

      # Test if left matches
      #
      # @param [Object] value
      #
      # @api private
      #
      def left_matches?(value)
        left.matches?(value)
      end

      # Test if right matches
      #
      # @param [Object] value
      #
      # @api private
      #
      def right_matches?(value)
        right.matches?(value)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vanguard-0.0.5 lib/vanguard/matcher/binary.rb
vanguard-0.0.4 lib/vanguard/matcher/binary.rb
vanguard-0.0.3 lib/vanguard/matcher/binary.rb