Class: Neo4j::Driver::Types::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/driver/types/node.rb

Overview

Represents a Node in the Neo4j graph

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, labels, properties, element_id = nil) ⇒ Node

Returns a new instance of Node.



10
11
12
13
14
15
# File 'lib/neo4j/driver/types/node.rb', line 10

def initialize(id, labels, properties, element_id = nil)
  @id = id
  @labels = labels
  @properties = properties
  @element_id = element_id || id.to_s
end

Instance Attribute Details

#element_idObject (readonly)

Returns the value of attribute element_id.



8
9
10
# File 'lib/neo4j/driver/types/node.rb', line 8

def element_id
  @element_id
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/neo4j/driver/types/node.rb', line 8

def id
  @id
end

#labelsObject (readonly)

Returns the value of attribute labels.



8
9
10
# File 'lib/neo4j/driver/types/node.rb', line 8

def labels
  @labels
end

#propertiesObject (readonly)

Returns the value of attribute properties.



8
9
10
# File 'lib/neo4j/driver/types/node.rb', line 8

def properties
  @properties
end

Instance Method Details

#==(other) ⇒ Object



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

def ==(other)
  other.is_a?(Node) && other.id == @id
end

#[](key) ⇒ Object



17
18
19
# File 'lib/neo4j/driver/types/node.rb', line 17

def [](key)
  @properties[key.to_s] || @properties[key.to_sym]
end