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-5.2.7 lib/neo4j/shared/identity.rb
neo4j-5.2.6 lib/neo4j/shared/identity.rb
neo4j-5.2.5 lib/neo4j/shared/identity.rb
neo4j-5.2.3 lib/neo4j/shared/identity.rb
neo4j-5.2.2 lib/neo4j/shared/identity.rb
neo4j-5.2.1 lib/neo4j/shared/identity.rb
neo4j-5.2.0 lib/neo4j/shared/identity.rb
neo4j-5.1.5 lib/neo4j/shared/identity.rb
neo4j-5.1.4 lib/neo4j/shared/identity.rb
neo4j-5.1.3 lib/neo4j/shared/identity.rb
neo4j-5.1.2 lib/neo4j/shared/identity.rb
neo4j-5.1.1 lib/neo4j/shared/identity.rb
neo4j-5.1.0 lib/neo4j/shared/identity.rb
neo4j-5.1.0.rc.3 lib/neo4j/shared/identity.rb
neo4j-5.1.0.rc.2 lib/neo4j/shared/identity.rb
neo4j-5.1.0.rc.1 lib/neo4j/shared/identity.rb
neo4j-5.0.15 lib/neo4j/shared/identity.rb
neo4j-5.0.14 lib/neo4j/shared/identity.rb
neo4j-5.0.13 lib/neo4j/shared/identity.rb
neo4j-5.0.12 lib/neo4j/shared/identity.rb