Module: ThinModels::Struct::IdentityMethods

Defined in:
lib/thin_models/struct/identity.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



6
7
8
# File 'lib/thin_models/struct/identity.rb', line 6

def ==(other)
  super || (other.is_a?(self.class) && (id = self.id) && other.id == id) || false
end

#eql?(other) ⇒ Boolean

this was: alias :eql? :==, but that ran into redmine.ruby-lang.org/issues/show/734

Returns:

  • (Boolean)


15
16
17
# File 'lib/thin_models/struct/identity.rb', line 15

def eql?(other)
  super || (other.is_a?(self.class) && (id = self.id) && other.id == id) || false
end

#hashObject



10
11
12
# File 'lib/thin_models/struct/identity.rb', line 10

def hash
  id ? id.hash : super
end