Class: Neo4j::Core::Node

Inherits:
Object
  • Object
show all
Includes:
Wrappable
Defined in:
lib/neo4j/core/node.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Wrappable

included

Constructor Details

#initialize(id, labels, properties = {}) ⇒ Node

Returns a new instance of Node.



15
16
17
18
19
# File 'lib/neo4j/core/node.rb', line 15

def initialize(id, labels, properties = {})
  @id = id
  @labels = labels.map(&:to_sym) unless labels.nil?
  @properties = properties.symbolize_keys
end

Instance Attribute Details

#idObject (readonly) Also known as: neo_id

Returns the value of attribute id.



7
8
9
# File 'lib/neo4j/core/node.rb', line 7

def id
  @id
end

#labelsObject (readonly)

Returns the value of attribute labels.



7
8
9
# File 'lib/neo4j/core/node.rb', line 7

def labels
  @labels
end

#propertiesObject (readonly) Also known as: props

Returns the value of attribute properties.



7
8
9
# File 'lib/neo4j/core/node.rb', line 7

def properties
  @properties
end

Class Method Details

.from_url(url, properties = {}) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/neo4j/core/node.rb', line 26

def from_url(url, properties = {})
  id = url.split('/')[-1].to_i
  labels = nil # unknown
  properties = properties

  new(id, labels, properties)
end

Instance Method Details

#==(other) ⇒ Object



21
22
23
# File 'lib/neo4j/core/node.rb', line 21

def ==(other)
  other.is_a?(Node) && neo_id == other.neo_id
end