module Equalizer::Methods

The comparison methods

Public Instance Methods

==(other) click to toggle source

Compare the object with other object for equivalency

@example

object == other  # => true or false

@param [Object] other

the other object to compare with

@return [Boolean]

@api public

# File lib/equalizer.rb, line 115
def ==(other)
  other = coerce(other).first if respond_to?(:coerce, true)
  other.kind_of?(self.class) && cmp?(__method__, other)
end
eql?(other) click to toggle source

Compare the object with other object for equality

@example

object.eql?(other)  # => true or false

@param [Object] other

the other object to compare with

@return [Boolean]

@api public

# File lib/equalizer.rb, line 100
def eql?(other)
  instance_of?(other.class) && cmp?(__method__, other)
end