Sha256: 8eab56b6fcfdce807455f548472a0e61ee5781518db6f6f354f2cfdafe225084

Contents?: true

Size: 709 Bytes

Versions: 92

Compression:

Stored size: 709 Bytes

Contents

module Neo4j
  module Shared
    module Identity
      def ==(other)
        other.class == self.class && other.id == id
      end
      alias 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
        if self.class.id_property_name
          send(self.class.id_property_name)
        else
          # ActiveRel
          neo_id
        end
      end

      def hash
        id.hash
      end
    end
  end
end

Version data entries

92 entries across 92 versions & 2 rubygems

Version Path
neo4j-9.6.2 lib/neo4j/shared/identity.rb
activegraph-10.0.0.pre.alpha.11 lib/neo4j/shared/identity.rb
activegraph-10.0.0.pre.alpha.10 lib/neo4j/shared/identity.rb
activegraph-10.0.0.pre.alpha.9 lib/neo4j/shared/identity.rb
activegraph-10.0.0.pre.alpha.8 lib/neo4j/shared/identity.rb
activegraph-10.0.0.pre.alpha.7 lib/neo4j/shared/identity.rb
activegraph-10.0.0.pre.alpha.6 lib/neo4j/shared/identity.rb
neo4j-10.0.0.pre.alpha.5 lib/neo4j/shared/identity.rb
neo4j-10.0.0.pre.alpha.4 lib/neo4j/shared/identity.rb
neo4j-10.0.0.pre.alpha.3 lib/neo4j/shared/identity.rb
neo4j-10.0.0.pre.alpha.2 lib/neo4j/shared/identity.rb
neo4j-10.0.0.pre.alpha.1 lib/neo4j/shared/identity.rb
neo4j-9.6.1 lib/neo4j/shared/identity.rb
neo4j-9.6.0 lib/neo4j/shared/identity.rb
neo4j-9.5.3 lib/neo4j/shared/identity.rb
neo4j-9.5.2 lib/neo4j/shared/identity.rb
neo4j-9.5.0 lib/neo4j/shared/identity.rb
neo4j-9.4.0 lib/neo4j/shared/identity.rb
neo4j-9.3.0 lib/neo4j/shared/identity.rb
neo4j-9.2.4 lib/neo4j/shared/identity.rb