annoy-rb 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/ext/annoy/annoy.hpp +22 -4
- data/lib/annoy/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7232280d8b48fb91e8df376002737365c98025a749ac940c768c8678bbfeed7
|
4
|
+
data.tar.gz: 2f877a4dbdc4cde3ed5dea581aa1007ca1f7f084a1984b39715b3955311a7e71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69215b205bb28a0e598232392db21dcafa292f6acda6c163570a5125ee10207d223f673852ffa7de4e92e7a301fc0efaf18399ba411f7f51453f6ef801af3121
|
7
|
+
data.tar.gz: 6854842c3f9b88252050980c7ed0341993ffae89457c045dcda8fb21cd462af103fd60522df4e69eaf032f73e618a99dcc079a2741a37c86ae4c9d7d2afec385
|
data/CHANGELOG.md
CHANGED
data/ext/annoy/annoy.hpp
CHANGED
@@ -42,17 +42,21 @@ template<class T, typename F> class RbAnnoyIndex
|
|
42
42
|
public:
|
43
43
|
static VALUE annoy_index_alloc(VALUE self) {
|
44
44
|
T* ptr = (T*)ruby_xmalloc(sizeof(T));
|
45
|
-
return
|
45
|
+
return TypedData_Wrap_Struct(self, &annoy_index_type, ptr);
|
46
46
|
};
|
47
47
|
|
48
|
-
static void annoy_index_free(
|
49
|
-
ptr->~AnnoyIndex();
|
48
|
+
static void annoy_index_free(void* ptr) {
|
49
|
+
((T*)ptr)->~AnnoyIndex();
|
50
50
|
ruby_xfree(ptr);
|
51
51
|
};
|
52
52
|
|
53
|
+
static size_t annoy_index_size(const void* ptr) {
|
54
|
+
return sizeof(*((T*)ptr));
|
55
|
+
};
|
56
|
+
|
53
57
|
static T* get_annoy_index(VALUE self) {
|
54
58
|
T* ptr;
|
55
|
-
|
59
|
+
TypedData_Get_Struct(self, T, &annoy_index_type, ptr);
|
56
60
|
return ptr;
|
57
61
|
};
|
58
62
|
|
@@ -79,6 +83,7 @@ template<class T, typename F> class RbAnnoyIndex
|
|
79
83
|
};
|
80
84
|
|
81
85
|
private:
|
86
|
+
static const rb_data_type_t annoy_index_type;
|
82
87
|
|
83
88
|
static VALUE _annoy_index_init(VALUE self, VALUE _n_dims) {
|
84
89
|
const int n_dims = NUM2INT(_n_dims);
|
@@ -308,4 +313,17 @@ template<class T, typename F> class RbAnnoyIndex
|
|
308
313
|
};
|
309
314
|
};
|
310
315
|
|
316
|
+
template<class T, typename F>
|
317
|
+
const rb_data_type_t RbAnnoyIndex<T, F>::annoy_index_type = {
|
318
|
+
"RbAnnoyIndex",
|
319
|
+
{
|
320
|
+
NULL,
|
321
|
+
RbAnnoyIndex::annoy_index_free,
|
322
|
+
RbAnnoyIndex::annoy_index_size
|
323
|
+
},
|
324
|
+
NULL,
|
325
|
+
NULL,
|
326
|
+
RUBY_TYPED_FREE_IMMEDIATELY
|
327
|
+
};
|
328
|
+
|
311
329
|
#endif /* ANNOY_HPP */
|
data/lib/annoy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: annoy-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yoshoku
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Annoy.rb is a Ruby binding for the Annoy (Approximate Nearest Neighbors
|
14
14
|
Oh Yeah).
|
@@ -45,7 +45,7 @@ metadata:
|
|
45
45
|
source_code_uri: https://github.com/yoshoku/annoy.rb
|
46
46
|
changelog_uri: https://github.com/yoshoku/annoy.rb/blob/master/CHANGELOG.md
|
47
47
|
documentation_uri: https://yoshoku.github.io/annoy.rb/doc/
|
48
|
-
post_install_message:
|
48
|
+
post_install_message:
|
49
49
|
rdoc_options: []
|
50
50
|
require_paths:
|
51
51
|
- lib
|
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
61
|
version: '0'
|
62
62
|
requirements: []
|
63
63
|
rubygems_version: 3.1.4
|
64
|
-
signing_key:
|
64
|
+
signing_key:
|
65
65
|
specification_version: 4
|
66
66
|
summary: Ruby binding for the Annoy (Approximate Nearest Neighbors Oh Yeah).
|
67
67
|
test_files: []
|