ngt 0.5.0 → 0.6.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51b1abeb2e5e028a0481de31deef2b037d71ad718e3a498b9a98eff6dcb4162f
4
- data.tar.gz: c1f81fac7b48002a1718a9259e2594ac5ff1bfb204cf56e3badb163d567e6df0
3
+ metadata.gz: 844216a2eebfc52ad1b33e2483aa7ed681e9d524e36b965f1c041620bd0daaaf
4
+ data.tar.gz: 632a23054de7545cb9498977ca9d37e6410c26389b3da78c8b2be6b830fc4be3
5
5
  SHA512:
6
- metadata.gz: 854abeff08d395907fe40042b123e95b8622733098ade14b9f9c47a8afd8e3856c78e40659521ee7853586ba6ab5208c37fd97bb7c7e028cb768f1c7b541335d
7
- data.tar.gz: e0dd9ef7c8e2c298e8a07d98993a8b2ec0c651f960361b341ae3c49d613b10708e00e9256d454ef7a72bcc1ba03461233de1339447b744f3e4a16204f9910a15
6
+ metadata.gz: 7d98bca10938397f8a94d132c702c5fec3c89476b54b5ff241eb627ebdc7bfc492f4e9964a50742dcd6cee66f9669f4f405cd0069ead87e9615d29dfbe71e3a8
7
+ data.tar.gz: '090749e8aa3f7834e0a25d69225a11c7fc9c0c3467e7a79d7ddc012a6196257a83c48d34d7423f7fea8ab065e9201906bee61783364a39d72b89bc662f70a1f8'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.6.0 (2026-02-27)
2
+
3
+ - Updated NGT to 2.6.0
4
+ - Dropped support for Ruby < 3.2
5
+
1
6
  ## 0.5.0 (2024-10-23)
2
7
 
3
8
  - Updated NGT to 2.2.4
data/lib/ngt/ffi.rb CHANGED
@@ -76,14 +76,5 @@ module Ngt
76
76
  attach_function :ngt_optimizer_execute, %i[pointer string string pointer], :bool
77
77
  attach_function :ngt_optimizer_set, %i[pointer int int int float float float float double double pointer], :bool
78
78
  attach_function :ngt_destroy_optimizer, %i[pointer], :void
79
-
80
- def self.add_finalizer(pointer, method)
81
- ObjectSpace.define_finalizer(pointer, finalize(pointer.to_i, method))
82
- end
83
-
84
- def self.finalize(addr, method)
85
- # must use proc instead of stabby lambda
86
- proc { FFI.send(method, ::FFI::Pointer.new(:pointer, addr)) }
87
- end
88
79
  end
89
80
  end
data/lib/ngt/index.rb CHANGED
@@ -9,10 +9,10 @@ module Ngt
9
9
  @path = path
10
10
 
11
11
  @error = FFI.ngt_create_error_object
12
- FFI.add_finalizer(@error, :ngt_destroy_error_object)
12
+ @error = ::FFI::AutoPointer.new(@error, FFI.method(:ngt_destroy_error_object))
13
13
 
14
14
  @property = ffi(:ngt_create_property)
15
- FFI.add_finalizer(@property, :ngt_destroy_property)
15
+ @property = ::FFI::AutoPointer.new(@property, FFI.method(:ngt_destroy_property))
16
16
  ffi(:ngt_get_property, @index, @property)
17
17
  end
18
18
 
@@ -125,9 +125,14 @@ module Ngt
125
125
  FFI.ngt_close_index(@index)
126
126
  end
127
127
 
128
- def self.new(dimensions, path: nil, edge_size_for_creation: 10,
129
- edge_size_for_search: 40, object_type: :float, distance_type: :l2)
130
-
128
+ def self.new(
129
+ dimensions,
130
+ path: nil,
131
+ edge_size_for_creation: 10,
132
+ edge_size_for_search: 40,
133
+ object_type: :float,
134
+ distance_type: :l2
135
+ )
131
136
  error = FFI.ngt_create_error_object
132
137
 
133
138
  if path && dimensions.nil?
@@ -178,7 +183,7 @@ module Ngt
178
183
  end
179
184
  end
180
185
 
181
- FFI.add_finalizer(index, :ngt_close_index)
186
+ index = ::FFI::AutoPointer.new(index, FFI.method(:ngt_close_index))
182
187
 
183
188
  super(index, path)
184
189
  ensure
data/lib/ngt/optimizer.rb CHANGED
@@ -4,10 +4,10 @@ module Ngt
4
4
 
5
5
  def initialize(outgoing: 10, incoming: 120, queries: 100, low_accuracy_from: 0.3, low_accuracy_to: 0.5, high_accuracy_from: 0.8, high_accuracy_to: 0.9, gt_epsilon: 0.1, merge: 0.2)
6
6
  @error = FFI.ngt_create_error_object
7
- FFI.add_finalizer(@error, :ngt_destroy_error_object)
7
+ @error = ::FFI::AutoPointer.new(@error, FFI.method(:ngt_destroy_error_object))
8
8
 
9
9
  @optimizer = ffi(:ngt_create_optimizer, true)
10
- FFI.add_finalizer(@optimizer, :ngt_destroy_optimizer)
10
+ @optimizer = ::FFI::AutoPointer.new(@optimizer, FFI.method(:ngt_destroy_optimizer))
11
11
 
12
12
  ffi(:ngt_optimizer_set, @optimizer, outgoing, incoming, queries, low_accuracy_from,
13
13
  low_accuracy_to, high_accuracy_from, high_accuracy_to, gt_epsilon, merge)
data/lib/ngt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ngt
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ngt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-10-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: ffi
@@ -24,7 +23,6 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
27
- description:
28
26
  email: andrew@ankane.org
29
27
  executables: []
30
28
  extensions: []
@@ -56,7 +54,6 @@ homepage: https://github.com/ankane/ngt-ruby
56
54
  licenses:
57
55
  - Apache-2.0
58
56
  metadata: {}
59
- post_install_message:
60
57
  rdoc_options: []
61
58
  require_paths:
62
59
  - lib
@@ -64,15 +61,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
64
61
  requirements:
65
62
  - - ">="
66
63
  - !ruby/object:Gem::Version
67
- version: '3.1'
64
+ version: '3.2'
68
65
  required_rubygems_version: !ruby/object:Gem::Requirement
69
66
  requirements:
70
67
  - - ">="
71
68
  - !ruby/object:Gem::Version
72
69
  version: '0'
73
70
  requirements: []
74
- rubygems_version: 3.5.16
75
- signing_key:
71
+ rubygems_version: 4.0.3
76
72
  specification_version: 4
77
73
  summary: High-speed approximate nearest neighbors for Ruby
78
74
  test_files: []