Class: Redgraph::Node
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#label ⇒ Object
Returns the value of attribute label.
-
#properties ⇒ Object
Returns the value of attribute properties.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(label: nil, properties: nil, id: nil) ⇒ Node
constructor
A new instance of Node.
- #persisted? ⇒ Boolean
- #to_query_string(item_alias: 'node') ⇒ Object
Methods included from Util
#escape_value, #properties_to_string
Constructor Details
#initialize(label: nil, properties: nil, id: nil) ⇒ Node
Returns a new instance of Node.
9 10 11 12 13 |
# File 'lib/redgraph/node.rb', line 9 def initialize(label: nil, properties: nil, id: nil) @id = id @label = label @properties = (properties || {}).with_indifferent_access end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/redgraph/node.rb', line 7 def id @id end |
#label ⇒ Object
Returns the value of attribute label.
7 8 9 |
# File 'lib/redgraph/node.rb', line 7 def label @label end |
#properties ⇒ Object
Returns the value of attribute properties.
7 8 9 |
# File 'lib/redgraph/node.rb', line 7 def properties @properties end |
Instance Method Details
#==(other) ⇒ Object
19 20 21 |
# File 'lib/redgraph/node.rb', line 19 def ==(other) super || other.instance_of?(self.class) && !id.nil? && other.id == id end |
#persisted? ⇒ Boolean
15 16 17 |
# File 'lib/redgraph/node.rb', line 15 def persisted? id.present? end |
#to_query_string(item_alias: 'node') ⇒ Object
23 24 25 26 |
# File 'lib/redgraph/node.rb', line 23 def to_query_string(item_alias: 'node') _label = ":#{label}" if label "(#{item_alias}#{_label} #{properties_to_string(properties)})" end |