Sha256: f798f11515c42aa944df10212bc17c9a3d2d6338639617dbe72465abad6312c7

Contents?: true

Size: 910 Bytes

Versions: 3

Compression:

Stored size: 910 Bytes

Contents

module Vanguard
  class Matcher
    class Nullary
      # Equality matcher
      class Identity < self
        include Equalizer.new(:value)

        # Return value
        #
        # @return [Object]
        #
        # @api private
        #
        attr_reader :value

        # Test if value for equality
        #
        # @param [Object] value
        #
        # @return [true]
        #
        # @return [false]
        #
        # @api private
        #
        def matches?(value)
          value.equal?(self.value)
        end

      private

        # Intialize object
        #
        # @param [Object] value
        #
        # @return [undefined]
        #
        # @api private
        #
        def initialize(value)
          @value = value
        end

        TRUE  = Identity.new(true)
        FALSE = Identity.new(false)
        NIL   = Identity.new(nil)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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