Class: Cyrel::Clause::Create
Overview
Represents a CREATE clause in a Cypher query.
Instance Attribute Summary collapse
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
-
#initialize(pattern) ⇒ Create
constructor
A new instance of Create.
-
#render(query) ⇒ String
Renders the CREATE clause.
Constructor Details
#initialize(pattern) ⇒ Create
Returns a new instance of Create.
11 12 13 14 15 16 17 18 |
# File 'lib/cyrel/clause/create.rb', line 11 def initialize(pattern) Cyrel::Pattern.assert_pattern!(pattern, 'CREATE') # NOTE: Creating relationships between existing nodes requires coordination. # The pattern itself should reference existing aliases defined in a preceding MATCH/MERGE. # The Query object might need to track defined aliases if validation is needed here. @pattern = pattern end |
Instance Attribute Details
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
7 8 9 |
# File 'lib/cyrel/clause/create.rb', line 7 def pattern @pattern end |
Instance Method Details
#render(query) ⇒ String
Renders the CREATE clause.
23 24 25 26 |
# File 'lib/cyrel/clause/create.rb', line 23 def render(query) pattern_string = @pattern.render(query) "CREATE #{pattern_string}" end |