rb_lovely 0.3.4 → 0.3.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.
- checksums.yaml +4 -4
- data/ext/rb_lovely/package.cpp +1 -1
- data/ext/rb_lovely/ruby_util.hpp +2 -2
- data/ext/rb_lovely/sorted_hash.cpp +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa291ad84cd1fa7db1a13c62a7647e49adb0b265
|
4
|
+
data.tar.gz: 7bfa34a4ee273bfdfd429a7709092df5bf8bdada
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f998f792864a6cf390f002c71828531b83b1e5cc81464e8ea8101022c41c178475faee730f69376b4b01c2acecc2b131d4d6089d491c60aad11d06098acc1737
|
7
|
+
data.tar.gz: c531ac60d13661fd9192403d60b0faf1aebf1f224c4b66200e0ed2b5550a327b1ce6cc89549158f46602cfb76d31c392afe27102b6f7c1138002758850fee6b6
|
data/ext/rb_lovely/package.cpp
CHANGED
data/ext/rb_lovely/ruby_util.hpp
CHANGED
@@ -6,7 +6,7 @@ namespace rb_lovely {
|
|
6
6
|
|
7
7
|
extern VALUE rbMod;
|
8
8
|
extern VALUE cmpMethSym;
|
9
|
-
extern VALUE
|
9
|
+
extern VALUE hashEqualitySym;
|
10
10
|
extern VALUE to_sSym;
|
11
11
|
extern VALUE hashSym;
|
12
12
|
extern VALUE callSym;
|
@@ -32,7 +32,7 @@ VALUE rubyAlloc(VALUE klass) {
|
|
32
32
|
static void initRubyUtil() {
|
33
33
|
rbMod = rb_define_module("RbLovely");
|
34
34
|
cmpMethSym = rb_intern("<=>");
|
35
|
-
|
35
|
+
hashEqualitySym = rb_intern("eql?");
|
36
36
|
to_sSym = rb_intern("to_s");
|
37
37
|
hashSym = rb_intern("hash");
|
38
38
|
callSym = rb_intern("call");
|
@@ -19,7 +19,7 @@ struct member {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
bool operator==(member const& rhs) const {
|
22
|
-
auto equalityVal = rb_funcall(key,
|
22
|
+
auto equalityVal = rb_funcall(key, hashEqualitySym, 1, rhs.key);
|
23
23
|
return RTEST(equalityVal);
|
24
24
|
}
|
25
25
|
|
@@ -219,6 +219,8 @@ extern "C" {
|
|
219
219
|
rb_define_method(rbHash, "initialize", RUBY_METHOD_FUNC(hashInitialize), -1);
|
220
220
|
rb_define_method(rbHash, "length", RUBY_METHOD_FUNC(hashLength), 0);
|
221
221
|
rb_define_method(rbHash, "[]=", RUBY_METHOD_FUNC(hashUpdate), 2);
|
222
|
+
// like []= but return previous value if there was one
|
223
|
+
// rb_define_method(rbHash, "set", RUBY_METHOD_FUNC(hashGetAndUpdate), 2);
|
222
224
|
rb_define_method(rbHash, "[]", RUBY_METHOD_FUNC(hashGet), 1);
|
223
225
|
rb_define_method(rbHash, "each", RUBY_METHOD_FUNC(hashEach), 0);
|
224
226
|
rb_define_method(rbHash, "to_s", RUBY_METHOD_FUNC(hashToString), 0);
|
@@ -233,6 +235,9 @@ extern "C" {
|
|
233
235
|
// Enumerable would test both key and value for include?
|
234
236
|
rb_define_method(rbHash, "include?", RUBY_METHOD_FUNC(hashHas), 1);
|
235
237
|
rb_define_method(rbHash, "has_key?", RUBY_METHOD_FUNC(hashHas), 1);
|
238
|
+
rb_define_method(rbHash, "key?", RUBY_METHOD_FUNC(hashHas), 1);
|
239
|
+
// rb_define_method(rbHash, "has_value?", RUBY_METHOD_FUNC(hashHasValue), 1);
|
240
|
+
// rb_define_method(rbHash, "value?", RUBY_METHOD_FUNC(hashHasValue), 1);
|
236
241
|
}
|
237
242
|
}
|
238
243
|
#endif
|