Class: Neo4j::Core::Node
- Inherits:
-
Object
- Object
- Neo4j::Core::Node
- Includes:
- Wrappable
- Defined in:
- lib/neo4j/core/node.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
(also: #neo_id)
readonly
Returns the value of attribute id.
-
#labels ⇒ Object
readonly
Returns the value of attribute labels.
-
#properties ⇒ Object
(also: #props)
readonly
Returns the value of attribute properties.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(id, labels, properties = {}) ⇒ Node
constructor
A new instance of Node.
Methods included from Wrappable
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
#id ⇒ Object (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 |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
7 8 9 |
# File 'lib/neo4j/core/node.rb', line 7 def labels @labels end |
#properties ⇒ Object (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 |