Module: Draper::Decoratable::Equality

Included in:
Draper::Decoratable
Defined in:
lib/draper/decoratable/equality.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.test(object, other) ⇒ Boolean

Compares an object to a possibly-decorated object.

Returns:

  • (Boolean)


14
15
16
17
# 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

Instance Method Details

#==(other) ⇒ Boolean

Compares self with a possibly-decorated object.

Returns:

  • (Boolean)


7
8
9
# File 'lib/draper/decoratable/equality.rb', line 7

def ==(other)
  super || Equality.test_for_decorator(self, other)
end