Sha256: e2b7be24724cf077ae623570779eeba0cbc50077afa07897d1e378b7b4415a72

Contents?: true

Size: 554 Bytes

Versions: 15

Compression:

Stored size: 554 Bytes

Contents

module Neo4j::Shared
  module Identity
    def ==(o)
      o.class == self.class && o.id == id
    end
    alias_method :eql?, :==

    # Returns an Enumerable of all (primary) key attributes
    # or nil if model.persisted? is false
    def to_key
      persisted? ? [id] : nil
    end

    # @return [Fixnum, nil] the neo4j id of the node if persisted or nil
    def neo_id
      _persisted_obj ? _persisted_obj.neo_id : nil
    end

    def id
      id = neo_id
      id.is_a?(Integer) ? id : nil
    end

    def hash
      id.hash
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
neo4j-4.0.0 lib/neo4j/shared/identity.rb
neo4j-4.0.0.rc.4 lib/neo4j/shared/identity.rb
neo4j-4.0.0.rc.3 lib/neo4j/shared/identity.rb
neo4j-4.0.0.rc.1 lib/neo4j/shared/identity.rb
neo4j-3.0.4 lib/neo4j/shared/identity.rb
neo4j-3.0.3 lib/neo4j/shared/identity.rb
neo4j-3.0.2 lib/neo4j/shared/identity.rb
neo4j-3.0.1 lib/neo4j/shared/identity.rb
neo4j-3.0.0 lib/neo4j/shared/identity.rb
neo4j-3.0.0.rc.5 lib/neo4j/shared/identity.rb
neo4j-3.0.0.rc.4 lib/neo4j/shared/identity.rb
neo4j-3.0.0.rc.3 lib/neo4j/shared/identity.rb
neo4j-3.0.0.rc.2 lib/neo4j/shared/identity.rb
neo4j-3.0.0.alpha.11 lib/neo4j/shared/identity.rb
neo4j-3.0.0.alpha.10 lib/neo4j/shared/identity.rb