def cmp?(other, operator)
      return false unless repository.send(operator, other.repository) &&
                          key.send(operator, other.key)

      if saved? && other.saved?
        # if dirty attributes match then they are the same resource
        dirty_attributes == other.dirty_attributes
      else
        # compare properties for unsaved resources
        properties.all? do |property|
          __send__(property.name).send(operator, other.__send__(property.name))
        end
      end
    end
def cmp?(other, operator)
      return false unless repository.send(operator, other.repository) &&
                          key.send(operator, other.key)

      if saved? && other.saved?
        # if dirty attributes match then they are the same resource
        dirty_attributes == other.dirty_attributes
      else
        # compare properties for unsaved resources
        properties.all? do |property|
          __send__(property.name).send(operator, other.__send__(property.name))
        end
      end
    end
Return true if +other+'s is equivalent or equal to +self+'s

 @param [Resource] other
   The Resource whose attributes are to be compared with +self+'s
 @param [Symbol] operator
   The comparison operator to use to compare the attributes

 @return [Boolean]
   The result of the comparison of +other+'s attributes with +self+'s

 @api private