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-7.2.3 lib/neo4j/shared/identity.rb
neo4j-7.2.2 lib/neo4j/shared/identity.rb
neo4j-7.1.4 lib/neo4j/shared/identity.rb
neo4j-7.0.16 lib/neo4j/shared/identity.rb
neo4j-7.2.1 lib/neo4j/shared/identity.rb
neo4j_legacy-7.2.0.2 lib/neo4j/shared/identity.rb
neo4j_legacy-7.2.0.1 lib/neo4j/shared/identity.rb
neo4j-7.2.0 lib/neo4j/shared/identity.rb
neo4j-7.1.3 lib/neo4j/shared/identity.rb
neo4j-7.0.15 lib/neo4j/shared/identity.rb
neo4j-7.1.2 lib/neo4j/shared/identity.rb
neo4j-7.1.1 lib/neo4j/shared/identity.rb
neo4j-7.1.0 lib/neo4j/shared/identity.rb
neo4j-7.0.14 lib/neo4j/shared/identity.rb
neo4j-7.0.13 lib/neo4j/shared/identity.rb
neo4j-7.0.12 lib/neo4j/shared/identity.rb
neo4j-7.0.11 lib/neo4j/shared/identity.rb
neo4j-7.0.10 lib/neo4j/shared/identity.rb
neo4j-7.0.9 lib/neo4j/shared/identity.rb
neo4j-7.0.8 lib/neo4j/shared/identity.rb