Sha256: 4a21d0c56dc4d0b3cdd5ada8d74e0a9c2d8b690a03fef88880761ea982128fb2

Contents?: true

Size: 555 Bytes

Versions: 5

Compression:

Stored size: 555 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
      persisted? ? neo_id.to_s : nil
    end


  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
neo4j-3.0.0.alpha.6 lib/neo4j/active_node/identity.rb
neo4j-3.0.0.alpha.5 lib/neo4j/active_node/identity.rb
neo4j-3.0.0.alpha.4 lib/neo4j/active_node/identity.rb
neo4j-3.0.0.alpha.3 lib/neo4j/active_node/identity.rb
neo4j-3.0.0.alpha.2 lib/neo4j/active_node/identity.rb