rb_lovely 0.3.6 → 0.3.7

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
  SHA1:
3
- metadata.gz: a5aaffcb2aeeca73c556c9a29b3c6800bd03994e
4
- data.tar.gz: c6b933b7ded2d336418e50423c5c30df9cd2db0b
3
+ metadata.gz: bfc1e9d10476bf6684d49b924c2df97da27a6dc4
4
+ data.tar.gz: e1b73faf1ccb468e1b5df4c95dcbb30858438aa0
5
5
  SHA512:
6
- metadata.gz: 65328353f0bffd687d74626f3a9c40f70f916d3d0160c046dc671daf3cda1e76959a2c6dc4d9e60e6ed3ab2eebfe5e259854f8722ac53f48cdf106d4904ea5b6
7
- data.tar.gz: ebc183484d5e723d7aebcdcae5738e1d2c28d38aaf8102d39236f75ca823aed2ac7ee3fa41b661b68959283b5cf2f26256e563473b870a49be4a96c329da0e7f
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);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb_lovely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Pike