activecypher 0.15.3 → 0.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/cyrel/query.rb CHANGED
@@ -213,40 +213,8 @@ module Cyrel
213
213
  # @return [self]
214
214
  # Because sometimes you just want to change everything and pretend it was always that way.
215
215
  def set(assignments)
216
- # Process assignments similar to existing Set clause
217
- processed_assignments = case assignments
218
- when Hash
219
- assignments.flat_map do |key, value|
220
- case key
221
- when Expression::PropertyAccess
222
- # SET n.prop = value
223
- [[:property, key, Expression.coerce(value)]]
224
- when Symbol, String
225
- # SET n = properties
226
- raise ArgumentError, 'Value for variable assignment must be a Hash' unless value.is_a?(Hash)
227
-
228
- [[:variable_properties, key.to_sym, Expression.coerce(value), :assign]]
229
- when Cyrel::Plus
230
- # SET n += properties
231
- raise ArgumentError, 'Value for variable assignment must be a Hash' unless value.is_a?(Hash)
232
-
233
- [[:variable_properties, key.variable.to_sym, Expression.coerce(value), :merge]]
234
- else
235
- raise ArgumentError, "Invalid key type in SET assignments: #{key.class}"
236
- end
237
- end
238
- when Array
239
- assignments.map do |item|
240
- unless item.is_a?(Array) && item.length == 2
241
- raise ArgumentError, "Invalid label assignment format. Expected [[:variable, 'Label'], ...], got #{item.inspect}"
242
- end
243
-
244
- # SET n:Label
245
- [:label, item[0].to_sym, item[1]]
246
- end
247
- else
248
- raise ArgumentError, "Invalid assignments type: #{assignments.class}"
249
- end
216
+ # Normalize assignments using the shared Set-clause logic
217
+ processed_assignments = Clause::Set.normalize_assignments(assignments)
250
218
 
251
219
  set_node = AST::SetNode.new(processed_assignments)
252
220
  ast_clause = AST::ClauseAdapter.new(set_node)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activecypher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.3
4
+ version: 0.15.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih
@@ -293,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
293
293
  - !ruby/object:Gem::Version
294
294
  version: '0'
295
295
  requirements: []
296
- rubygems_version: 4.0.6
296
+ rubygems_version: 4.0.10
297
297
  specification_version: 4
298
298
  summary: OpenCypher Adapter ala ActiveRecord
299
299
  test_files: []