class Redgraph::Node

Attributes

id[RW]
label[RW]
properties[RW]

Public Class Methods

new(label: nil, properties: nil, id: nil) click to toggle source
# 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

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/redgraph/node.rb, line 19
def ==(other)
  super || other.instance_of?(self.class) && !id.nil? && other.id == id
end
persisted?() click to toggle source
# File lib/redgraph/node.rb, line 15
def persisted?
  id.present?
end
to_query_string(item_alias: 'node') click to toggle source
# 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