class Redgraph::Edge

Attributes

dest[RW]
dest_id[RW]
id[RW]
properties[RW]
src[RW]
src_id[RW]
type[RW]

Public Class Methods

new(src: nil, dest: nil, type: nil, properties: {}) click to toggle source
# File lib/redgraph/edge.rb, line 9
def initialize(src: nil, dest: nil, type: nil, properties: {})
  @src = src
  @src_id = @src.id if @src
  @dest = dest
  @dest_id = @dest.id if @dest
  @type = type
  @properties = (properties || {}).with_indifferent_access
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/redgraph/edge.rb, line 22
def ==(other)
  super || other.instance_of?(self.class) && !id.nil? && other.id == id
end
persisted?() click to toggle source
# File lib/redgraph/edge.rb, line 18
def persisted?
  id.present?
end
to_query_string(item_alias: 'edge', src_alias: 'src', dest_alias: 'dest') click to toggle source
# File lib/redgraph/edge.rb, line 26
def to_query_string(item_alias: 'edge', src_alias: 'src', dest_alias: 'dest')
  _type = ":#{type}" if type
  "(#{src_alias})-[#{item_alias}#{_type} #{properties_to_string(properties)}]->(#{dest_alias})"
end