module ActiveGraph::Shared::Identity

Public Instance Methods

==(other) click to toggle source
  # File lib/active_graph/shared/identity.rb
4 def ==(other)
5   other.class == self.class && other.id == id
6 end
Also aliased as: eql?
eql?(other)
Alias for: ==
hash() click to toggle source
   # File lib/active_graph/shared/identity.rb
29 def hash
30   id.hash
31 end
id() click to toggle source
   # File lib/active_graph/shared/identity.rb
20 def id
21   if self.class.id_property_name
22     send(self.class.id_property_name)
23   else
24     # Relationship
25     neo_id
26   end
27 end
neo_id() click to toggle source

@return [Integer, nil] the neo4j id of the node if persisted or nil

   # File lib/active_graph/shared/identity.rb
16 def neo_id
17   _persisted_obj ? _persisted_obj.id : nil
18 end
to_key() click to toggle source

Returns an Enumerable of all (primary) key attributes or nil if model.persisted? is false

   # File lib/active_graph/shared/identity.rb
11 def to_key
12   _persisted_obj ? [id] : nil
13 end