Sha256: 00de0ef0f709d3b7f3281368c785617813d4fd73173dac363275ba617d7d3cea

Contents?: true

Size: 572 Bytes

Versions: 2

Compression:

Stored size: 572 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

    # @return [String, nil] same as #neo_id
    def id
      id = neo_id
      id.is_a?(Integer) ? id : nil
    end


  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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