Module: ActiveEntity::Identity::ClassMethods

Defined in:
lib/active_entity/identity.rb

Instance Method Summary collapse

Instance Method Details

#identity_attribute(*names) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/active_entity/identity.rb', line 11

def identity_attribute(*names)
  identity_attributes.concat(names.flatten)

  define_method(:==) do |other|
    return false unless self.class === other
    names.all? {|name| public_send(name) == other.public_send(name) }
  end
end