Class: Redgraph::Edge
Instance Attribute Summary collapse
-
#dest ⇒ Object
Returns the value of attribute dest.
-
#dest_id ⇒ Object
Returns the value of attribute dest_id.
-
#id ⇒ Object
Returns the value of attribute id.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#src ⇒ Object
Returns the value of attribute src.
-
#src_id ⇒ Object
Returns the value of attribute src_id.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(src: nil, dest: nil, type: nil, properties: {}) ⇒ Edge
constructor
A new instance of Edge.
- #persisted? ⇒ Boolean
- #to_query_string(item_alias: 'edge', src_alias: 'src', dest_alias: 'dest') ⇒ Object
Methods included from Util
#escape_value, #properties_to_string
Constructor Details
#initialize(src: nil, dest: nil, type: nil, properties: {}) ⇒ Edge
Returns a new instance of Edge.
9 10 11 12 13 14 15 16 |
# 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 |
Instance Attribute Details
#dest ⇒ Object
Returns the value of attribute dest.
7 8 9 |
# File 'lib/redgraph/edge.rb', line 7 def dest @dest end |
#dest_id ⇒ Object
Returns the value of attribute dest_id.
7 8 9 |
# File 'lib/redgraph/edge.rb', line 7 def dest_id @dest_id end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/redgraph/edge.rb', line 7 def id @id end |
#properties ⇒ Object
Returns the value of attribute properties.
7 8 9 |
# File 'lib/redgraph/edge.rb', line 7 def properties @properties end |
#src ⇒ Object
Returns the value of attribute src.
7 8 9 |
# File 'lib/redgraph/edge.rb', line 7 def src @src end |
#src_id ⇒ Object
Returns the value of attribute src_id.
7 8 9 |
# File 'lib/redgraph/edge.rb', line 7 def src_id @src_id end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/redgraph/edge.rb', line 7 def type @type end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 |
# File 'lib/redgraph/edge.rb', line 22 def ==(other) super || other.instance_of?(self.class) && !id.nil? && other.id == id end |
#persisted? ⇒ Boolean
18 19 20 |
# File 'lib/redgraph/edge.rb', line 18 def persisted? id.present? end |
#to_query_string(item_alias: 'edge', src_alias: 'src', dest_alias: 'dest') ⇒ Object
26 27 28 29 |
# 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 |