Sha256: ed487b8ce6e5fad75863ea8a582fc19fc1f5c72325340d796e9064fef3500dc6
Contents?: true
Size: 796 Bytes
Versions: 5
Compression:
Stored size: 796 Bytes
Contents
# frozen_string_literal: true module Redgraph class Edge include Util attr_accessor :id, :src, :dest, :src_id, :dest_id, :type, :properties 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 def persisted? id.present? end def ==(other) super || other.instance_of?(self.class) && !id.nil? && other.id == id end 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 end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
redgraph-0.2.3 | lib/redgraph/edge.rb |
redgraph-0.2.2 | lib/redgraph/edge.rb |
redgraph-0.2.1 | lib/redgraph/edge.rb |
redgraph-0.2.0 | lib/redgraph/edge.rb |
redgraph-0.1.4 | lib/redgraph/edge.rb |