activecypher 0.10.4 → 0.11.1

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.
@@ -11,13 +11,8 @@ module Cyrel
11
11
 
12
12
  def initialize
13
13
  @output = StringIO.new
14
- if defined?(Concurrent)
15
- @parameters = Concurrent::Hash.new
16
- @param_counter = Concurrent::AtomicFixnum.new(0)
17
- else
18
- @parameters = {}
19
- @param_counter = 0
20
- end
14
+ @parameters = {}
15
+ @param_counter = 0
21
16
  @first_clause = true
22
17
  @loop_variables = Set.new # Track loop variables that shouldn't be parameterized
23
18
  end
@@ -573,17 +568,9 @@ module Cyrel
573
568
  existing_key = @parameters.key(value)
574
569
  return existing_key if existing_key
575
570
 
576
- if defined?(Concurrent) && @parameters.is_a?(Concurrent::Hash)
577
- # Thread-safe parameter registration
578
-
579
- counter = @param_counter.increment
580
- key = :"p#{counter}"
581
- else
582
- # Non-concurrent version
583
-
584
- @param_counter += 1
585
- key = :"p#{@param_counter}"
586
- end
571
+ # Parameter registration
572
+ @param_counter += 1
573
+ key = :"p#{@param_counter}"
587
574
  @parameters[key] = value
588
575
  key
589
576
  end
data/lib/cyrel/logging.rb CHANGED
@@ -15,8 +15,6 @@ module Cyrel
15
15
 
16
16
  def resolve_log_level(log_level_str)
17
17
  Logger.const_get(log_level_str.upcase)
18
- rescue StandardError
19
- Logger::UNKNOWN
20
18
  end
21
19
 
22
20
  def logger
data/lib/cyrel/query.rb CHANGED
@@ -15,6 +15,7 @@ module Cyrel
15
15
  class Query
16
16
  include Parameterizable
17
17
  include Logging
18
+
18
19
  attr_reader :parameters, :clauses # Expose clauses for merge logic
19
20
 
20
21
  def initialize
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.10.4
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih
@@ -154,7 +154,6 @@ files:
154
154
  - lib/active_cypher/model/core.rb
155
155
  - lib/active_cypher/model/countable.rb
156
156
  - lib/active_cypher/model/destruction.rb
157
- - lib/active_cypher/model/inspectable.rb
158
157
  - lib/active_cypher/model/labelling.rb
159
158
  - lib/active_cypher/model/persistence.rb
160
159
  - lib/active_cypher/model/querying.rb
@@ -192,7 +191,6 @@ files:
192
191
  - lib/cyrel/ast/remove_node.rb
193
192
  - lib/cyrel/ast/return_node.rb
194
193
  - lib/cyrel/ast/set_node.rb
195
- - lib/cyrel/ast/simple_cache.rb
196
194
  - lib/cyrel/ast/skip_node.rb
197
195
  - lib/cyrel/ast/union_node.rb
198
196
  - lib/cyrel/ast/unwind_node.rb
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActiveCypher
4
- module Model
5
- # @!parse
6
- # # Adds a custom inspect method for pretty-printing a compact, single-line summary of the object.
7
- # # Because nothing says "debuggable" like a string that pretends your object is more interesting than it is.
8
- module Inspectable
9
- # Custom object inspection method for pretty-printing a compact,
10
- # single-line summary of the object. Output examples:
11
- #
12
- # #<UserNode id="26" name="Alice" age=34> => persisted object
13
- # #<UserNode (new) name="Bob"> => object not yet saved
14
- #
15
- def inspect
16
- # Put 'internal_id' first like it's the main character (even if it's nil)
17
- ordered = attributes.dup
18
- ordered = ordered.slice('internal_id').merge(ordered.except('internal_id'))
19
-
20
- # Turn each attr into "key: value" because we humans fear raw hashes
21
- parts = ordered.map { |k, v| "#{k}: #{v.inspect}" }
22
-
23
- # Wrap it all up in a fake-sane object string, so you can pretend your data is organized.
24
- "#<#{self.class} #{parts.join(', ')}>"
25
- end
26
- end
27
- end
28
- end
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'singleton'
4
-
5
- module Cyrel
6
- module AST
7
- # Simple thread-safe compilation cache
8
- # Because compiling the same query twice is like watching reruns
9
- class SimpleCache
10
- include Singleton
11
-
12
- def initialize
13
- @cache = {}
14
- @mutex = Mutex.new
15
- @max_size = 1000
16
- end
17
-
18
- def fetch(key)
19
- @mutex.synchronize do
20
- if @cache.key?(key)
21
- @cache[key]
22
- elsif block_given?
23
- value = yield
24
- store(key, value)
25
- value
26
- end
27
- end
28
- end
29
-
30
- def clear!
31
- @mutex.synchronize { @cache.clear }
32
- end
33
-
34
- def size
35
- @mutex.synchronize { @cache.size }
36
- end
37
-
38
- private
39
-
40
- def store(key, value)
41
- # Simple LRU: remove oldest entries when cache is full
42
- if @cache.size >= @max_size
43
- # Remove half of the oldest entries
44
- (@max_size / 2).times { @cache.shift }
45
- end
46
- @cache[key] = value
47
- end
48
- end
49
- end
50
- end