module Draper::Decoratable::Equality

Public Class Methods

test(object, other) click to toggle source

Compares an object to a possibly-decorated object.

@return [Boolean]

# File lib/draper/decoratable/equality.rb, line 14
def self.test(object, other)
  return object == other if object.is_a?(Decoratable)
  object == other || test_for_decorator(object, other)
end
test_for_decorator(object, other) click to toggle source

@private

# File lib/draper/decoratable/equality.rb, line 20
def self.test_for_decorator(object, other)
  other.respond_to?(:decorated?) && other.decorated? &&
  other.respond_to?(:object) && test(object, other.object)
end

Public Instance Methods

==(other) click to toggle source

Compares self with a possibly-decorated object.

@return [Boolean]

Calls superclass method
# File lib/draper/decoratable/equality.rb, line 7
def ==(other)
  super || Equality.test_for_decorator(self, other)
end