Class: Cyrel::Clause::Remove
Overview
Represents a REMOVE clause in a Cypher query. Used for removing properties or labels from nodes/relationships.
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
-
#initialize(items) ⇒ Remove
constructor
Initializes a REMOVE clause.
-
#merge!(other_remove) ⇒ Object
Merges items from another Remove clause.
-
#render(query) ⇒ String?
Renders the REMOVE clause.
Constructor Details
#initialize(items) ⇒ Remove
Initializes a REMOVE clause.
16 17 18 |
# File 'lib/cyrel/clause/remove.rb', line 16 def initialize(items) @items = process_items(items) # Remove flatten, expect correct array structure end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
8 9 10 |
# File 'lib/cyrel/clause/remove.rb', line 8 def items @items end |
Instance Method Details
#merge!(other_remove) ⇒ Object
Merges items from another Remove clause.
35 36 37 38 39 |
# File 'lib/cyrel/clause/remove.rb', line 35 def merge!(other_remove) # Simple concatenation, assumes no duplicate removals. @items.concat(other_remove.items) self end |
#render(query) ⇒ String?
Renders the REMOVE clause.
23 24 25 26 27 28 29 30 31 |
# File 'lib/cyrel/clause/remove.rb', line 23 def render(query) return nil if @items.empty? remove_parts = @items.map do |item| render_item(item, query) end "REMOVE #{remove_parts.join(', ')}" end |