Sha256: 7d24f81130e857f255e5bc8a9882467cbf29c97e783640ce9ec53191ebbe4c0c

Contents?: true

Size: 524 Bytes

Versions: 1

Compression:

Stored size: 524 Bytes

Contents

module Neo4j::ActiveNode
  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_node ? _persisted_node.neo_id : nil
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
neo4j-3.0.0.alpha.9 lib/neo4j/active_node/identity.rb