Sha256: 2e50cc9870055de2c9786fa796a2395267b7d2f72f4700426655d97bbd99da66

Contents?: true

Size: 571 Bytes

Versions: 112

Compression:

Stored size: 571 Bytes

Contents

module Neo4j::Shared
  module Identity
    def ==(other)
      other.class == self.class && other.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_obj ? [id] : nil
    end

    # @return [Integer, 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

112 entries across 112 versions & 2 rubygems

Version Path
neo4j-6.1.12 lib/neo4j/shared/identity.rb
neo4j-6.0.9 lib/neo4j/shared/identity.rb
neo4j-7.0.7 lib/neo4j/shared/identity.rb
neo4j-6.1.11 lib/neo4j/shared/identity.rb
neo4j-7.0.6 lib/neo4j/shared/identity.rb
neo4j-7.0.5 lib/neo4j/shared/identity.rb
neo4j-7.0.4 lib/neo4j/shared/identity.rb
neo4j-7.0.3 lib/neo4j/shared/identity.rb
neo4j-7.0.2 lib/neo4j/shared/identity.rb
neo4j-7.0.1 lib/neo4j/shared/identity.rb
neo4j-7.0.0 lib/neo4j/shared/identity.rb
neo4j-7.0.0.rc.7 lib/neo4j/shared/identity.rb
neo4j-7.0.0.rc.6 lib/neo4j/shared/identity.rb
neo4j-7.0.0.rc.5 lib/neo4j/shared/identity.rb
neo4j-6.1.10 lib/neo4j/shared/identity.rb
neo4j-6.0.8 lib/neo4j/shared/identity.rb
neo4j-7.0.0.rc.4 lib/neo4j/shared/identity.rb
neo4j-7.0.0.rc.3 lib/neo4j/shared/identity.rb
neo4j-7.0.0.rc.2 lib/neo4j/shared/identity.rb
neo4j-6.1.9 lib/neo4j/shared/identity.rb