Class: Cyrel::Pattern::Path
- Inherits:
-
Object
- Object
- Cyrel::Pattern::Path
- Defined in:
- lib/cyrel/pattern/path.rb
Overview
Represents a linear path pattern in a Cypher query, consisting of an alternating sequence of Node and Relationship objects.
Instance Attribute Summary collapse
-
#elements ⇒ Object
readonly
Returns the value of attribute elements.
Instance Method Summary collapse
-
#initialize(elements) ⇒ Path
constructor
A new instance of Path.
-
#render(query) ⇒ String
Renders the path pattern part of the Cypher query.
Constructor Details
#initialize(elements) ⇒ Path
Returns a new instance of Path.
12 13 14 15 |
# File 'lib/cyrel/pattern/path.rb', line 12 def initialize(elements) validate_elements(elements) @elements = elements end |
Instance Attribute Details
#elements ⇒ Object (readonly)
Returns the value of attribute elements.
8 9 10 |
# File 'lib/cyrel/pattern/path.rb', line 8 def elements @elements end |
Instance Method Details
#render(query) ⇒ String
Renders the path pattern part of the Cypher query.
20 21 22 |
# File 'lib/cyrel/pattern/path.rb', line 20 def render(query) @elements.map { |element| element.render(query) }.join end |