Sha256: 6d88508e6edf5860ffab558ed8b11346a97fd188cd30d2cf0b65f1a41cc9fdb9

Contents?: true

Size: 976 Bytes

Versions: 3

Compression:

Stored size: 976 Bytes

Contents

module Vanguard
  class Matcher
    class Unary

      # Matcher that matches on attribute of value
      class Attribute < self

        # Return operand result for length of value
        #
        # @return [true]
        #   if operand returns false
        #
        # @return [false]
        #   otherwise
        #
        # @api private
        #
        def matches?(value)
          operand_matches?(value.public_send(attribute_name))
        end

        # Return attribute name
        #
        # @return [Symbol]
        #
        # @api private
        #
        attr_reader :attribute_name

      private

        # Initialize object
        #
        # @param [Matcher] operand
        # @param [Symbol] attribute_name
        #
        # @return [undefined]
        #
        # @api private
        #
        def initialize(attribute_name, operand)
          @attribute_name = attribute_name
          super(operand)
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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