rb_lovely 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rb_lovely/sorted_hash.cpp +7 -0
- data/ext/rb_lovely/sorted_set.cpp +7 -0
- 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: bfc1e9d10476bf6684d49b924c2df97da27a6dc4
|
4
|
+
data.tar.gz: e1b73faf1ccb468e1b5df4c95dcbb30858438aa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 157d98da65f5be762d8a57d40fe58a977d219a971751e910efe0515559b7ffe57f4b0f8df48e1b5bbc8bb403a1d15ad573df2cc4e354ad63aaa8ebddcd11fc8a
|
7
|
+
data.tar.gz: e8979751ca9a9e274e949e985a1b1faf1861adc6b3bfe321ae21a3ba88e18f924f878b9cd0ae77a0893bce6b612e07981d0973eb51b48ade1ad692875d7cb6cf
|
@@ -92,6 +92,12 @@ VALUE hashInitialize(int argc, VALUE *argv, VALUE self) {
|
|
92
92
|
return self;
|
93
93
|
}
|
94
94
|
|
95
|
+
VALUE hashClear(VALUE self) {
|
96
|
+
Hash* hash = rubyCast<Hash>(self);
|
97
|
+
hash->container.clear();
|
98
|
+
return self;
|
99
|
+
}
|
100
|
+
|
95
101
|
VALUE hashUpdate(VALUE self, VALUE key, VALUE val) {
|
96
102
|
Hash* hash = rubyCast<Hash>(self);
|
97
103
|
auto it = hash->container.find(key);
|
@@ -230,6 +236,7 @@ extern "C" {
|
|
230
236
|
rb_include_module(rbHash, rb_const_get(rb_cObject, rb_intern("Enumerable")));
|
231
237
|
|
232
238
|
rb_define_method(rbHash, "initialize", RUBY_METHOD_FUNC(hashInitialize), -1);
|
239
|
+
rb_define_method(rbHash, "clear", RUBY_METHOD_FUNC(hashClear), 0);
|
233
240
|
rb_define_method(rbHash, "length", RUBY_METHOD_FUNC(hashLength), 0);
|
234
241
|
rb_define_method(rbHash, "[]=", RUBY_METHOD_FUNC(hashUpdate), 2);
|
235
242
|
// like []= but return previous value if there was one
|
@@ -35,6 +35,12 @@ VALUE setInitialize(int argc, VALUE *argv, VALUE self) {
|
|
35
35
|
return self;
|
36
36
|
}
|
37
37
|
|
38
|
+
VALUE setClear(VALUE self) {
|
39
|
+
Set* set = rubyCast<Set>(self);
|
40
|
+
set->clear();
|
41
|
+
return self;
|
42
|
+
}
|
43
|
+
|
38
44
|
VALUE setLength(VALUE self) {
|
39
45
|
Set* set = rubyCast<Set>(self);
|
40
46
|
return INT2NUM(set->size());
|
@@ -200,6 +206,7 @@ extern "C" {
|
|
200
206
|
rb_include_module(rbSet, rb_const_get(rb_cObject, rb_intern("Enumerable")));
|
201
207
|
|
202
208
|
rb_define_method(rbSet, "initialize", RUBY_METHOD_FUNC(setInitialize), -1);
|
209
|
+
rb_define_method(rbSet, "clear", RUBY_METHOD_FUNC(setClear), 0);
|
203
210
|
rb_define_method(rbSet, "length", RUBY_METHOD_FUNC(setLength), 0);
|
204
211
|
rb_define_method(rbSet, "add", RUBY_METHOD_FUNC(setAdd), 1);
|
205
212
|
rb_define_method(rbSet, "<<", RUBY_METHOD_FUNC(setAdd), 1);
|