Module: ActiveGraph::Shared::Identity
- Included in:
 - Node, Relationship
 
- Defined in:
 - lib/active_graph/shared/identity.rb
 
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
 - 
  
    
      #element_id  ⇒ String? 
    
    
      (also: #neo_id)
    
  
  
  
  
  
  
  
  
  
    
The neo4j id of the node if persisted or nil.
 - #hash ⇒ Object
 - #id ⇒ Object
 - 
  
    
      #to_key  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Returns an Enumerable of all (primary) key attributes or nil if model.persisted? is false.
 
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
      4 5 6  | 
    
      # File 'lib/active_graph/shared/identity.rb', line 4 def ==(other) other.class == self.class && other.id == id end  | 
  
#element_id ⇒ String? Also known as: neo_id
Returns the neo4j id of the node if persisted or nil.
      17 18 19  | 
    
      # File 'lib/active_graph/shared/identity.rb', line 17 def element_id _persisted_obj&.element_id end  | 
  
#hash ⇒ Object
      32 33 34  | 
    
      # File 'lib/active_graph/shared/identity.rb', line 32 def hash id.hash end  | 
  
#id ⇒ Object
      23 24 25 26 27 28 29 30  | 
    
      # File 'lib/active_graph/shared/identity.rb', line 23 def id if self.class.id_property_name send(self.class.id_property_name) else # Relationship neo_id end end  | 
  
#to_key ⇒ Object
Returns an Enumerable of all (primary) key attributes or nil if model.persisted? is false
      12 13 14  | 
    
      # File 'lib/active_graph/shared/identity.rb', line 12 def to_key _persisted_obj ? [id] : nil end  |