Class: Cyrel::Clause::Merge
Overview
Represents a MERGE clause in a Cypher query. Used to find a pattern or create it if it doesn’t exist.
Instance Attribute Summary collapse
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
-
#initialize(pattern) ⇒ Merge
constructor
A new instance of Merge.
-
#render(query) ⇒ String
Renders the MERGE clause.
Constructor Details
#initialize(pattern) ⇒ Merge
Returns a new instance of Merge.
14 15 16 17 18 |
# File 'lib/cyrel/clause/merge.rb', line 14 def initialize(pattern) Cyrel::Pattern.assert_pattern!(pattern, 'MERGE') @pattern = pattern end |
Instance Attribute Details
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
8 9 10 |
# File 'lib/cyrel/clause/merge.rb', line 8 def pattern @pattern end |
Instance Method Details
#render(query) ⇒ String
Renders the MERGE clause.
23 24 25 26 27 |
# File 'lib/cyrel/clause/merge.rb', line 23 def render(query) pattern_string = @pattern.render(query) "MERGE #{pattern_string}" # TODO: Append ON CREATE SET / ON MATCH SET rendering when implemented. end |