rb_lovely 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2496d7e867af251fca88b09f09d803be15a9a0d5
4
- data.tar.gz: 5f03cdfc07649d4f67fab1717086174b7d9499cc
3
+ metadata.gz: aa291ad84cd1fa7db1a13c62a7647e49adb0b265
4
+ data.tar.gz: 7bfa34a4ee273bfdfd429a7709092df5bf8bdada
5
5
  SHA512:
6
- metadata.gz: b887607522f3a5e4afd85672cd6b085b5e6f791b741ca88f887057e381a42903d7ae06191b1130fe4449f80228ab7111b93f8d51e32c5ef06d7b094d924cbcb8
7
- data.tar.gz: 73595cc2d2b79eda119ea76d2b2c9efdf44f781dee8915a1b7259885e56c19be2d5736ec0e7e489f2b2f60886da1b48ffed055e8b245444594b384475a483842
6
+ metadata.gz: f998f792864a6cf390f002c71828531b83b1e5cc81464e8ea8101022c41c178475faee730f69376b4b01c2acecc2b131d4d6089d491c60aad11d06098acc1737
7
+ data.tar.gz: c531ac60d13661fd9192403d60b0faf1aebf1f224c4b66200e0ed2b5550a327b1ce6cc89549158f46602cfb76d31c392afe27102b6f7c1138002758850fee6b6
@@ -4,7 +4,7 @@ namespace rb_lovely {
4
4
  // extern stuff from ruby_util
5
5
  VALUE rbMod;
6
6
  VALUE cmpMethSym;
7
- VALUE equalitySym;
7
+ VALUE hashEqualitySym;
8
8
  VALUE to_sSym;
9
9
  VALUE hashSym;
10
10
  VALUE compareSym;
@@ -6,7 +6,7 @@ namespace rb_lovely {
6
6
 
7
7
  extern VALUE rbMod;
8
8
  extern VALUE cmpMethSym;
9
- extern VALUE equalitySym;
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
- equalitySym = rb_intern("==");
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, equalitySym, 1, rhs.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
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.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Pike