sin_deep_merge 1.0.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: 3bb7df970ff6b8fc3a6f34f10d72fe39667ce8e24cab4d3861efa18e8148370c
4
- data.tar.gz: 8a8f34ab4a057967869cd813506e06b8b9a67d792fa7b4f2f532288850d557c2
3
+ metadata.gz: 695ce019f9e23c87a56b899794629eef8aad567f32af8204b7dbd42e6f14bf1b
4
+ data.tar.gz: b63c85ff319bee536d2ee92c42bdc30533e67b691db2d67455851ca99bdaed7b
5
5
  SHA512:
6
- metadata.gz: 0164c6eb5e5cf99174c26d49ac44638367a0f4373804d6a5c7afc85b149ba51cb6abf32b30644f98c2b0e345a1264d4e40037ca2f84fcf06897c6c4bb0e06a9b
7
- data.tar.gz: 1cda779bfbf3e02582d535f4a8b645178a148952a97c55896a82eeb0d9751e82d118dd9f1343e23c170953468ba21185b06090383d936e17aa870e3c343e6efe
6
+ metadata.gz: '0399320968046f31e0a68bdfbfbf2fa5838d37757ba7f1c920be4513de091ebdc64cefa84599178f2ed2488149f7469f41515050883771165c58956142c1bf89'
7
+ data.tar.gz: f29b8af3fbc7df6de7f940a878beecca72af8fca5af239cbb2ef49e9808ea51dc37de0701d2ddb158cfaa7c4ddaf71ce828bf3e6a8bdecc9d87c22139e4b24ff
@@ -13,7 +13,7 @@ typedef struct {
13
13
  static VALUE deep_merge_hashes(VALUE self, VALUE other, VALUE block, int destructive);
14
14
 
15
15
  static int deep_merge_iter(VALUE key, VALUE other_val, VALUE data) {
16
- deep_merge_context *ctx = (deep_merge_context *)data;
16
+ deep_merge_context* ctx = (deep_merge_context*)data;
17
17
  VALUE current_val = rb_hash_lookup2(ctx->hash, key, Qundef);
18
18
 
19
19
  if (current_val == Qundef) {
@@ -28,7 +28,8 @@ static int deep_merge_iter(VALUE key, VALUE other_val, VALUE data) {
28
28
  rb_hash_aset(ctx->hash, key, merged);
29
29
  } else if (ctx->block_given) {
30
30
  VALUE args[3] = {key, current_val, other_val};
31
- VALUE result = rb_proc_call(ctx->block, rb_ary_new_from_values(3, args));
31
+ /* rb_funcallv for TruffleRuby compat (Sulong lacks rb_proc_call_with_block) */
32
+ VALUE result = rb_funcallv(ctx->block, id_call, 3, args);
32
33
  rb_hash_aset(ctx->hash, key, result);
33
34
  } else {
34
35
  rb_hash_aset(ctx->hash, key, other_val);
@@ -46,10 +47,14 @@ static VALUE deep_merge_hashes(VALUE self, VALUE other, VALUE block, int destruc
46
47
  return self;
47
48
  }
48
49
 
49
- static VALUE hash_deep_merge_bang(int argc, VALUE *argv, VALUE self) {
50
+ static VALUE hash_deep_merge_bang(int argc, VALUE* argv, VALUE self) {
50
51
  VALUE other;
51
52
  rb_scan_args(argc, argv, "1", &other);
52
- other = rb_funcall(other, id_to_hash, 0);
53
+ rb_check_frozen(self);
54
+ if (!RB_TYPE_P(other, T_HASH)) {
55
+ other = rb_funcall(other, id_to_hash, 0);
56
+ Check_Type(other, T_HASH);
57
+ }
53
58
  VALUE block = Qnil;
54
59
  if (rb_block_given_p()) {
55
60
  block = rb_block_proc();
@@ -60,10 +65,13 @@ static VALUE hash_deep_merge_bang(int argc, VALUE *argv, VALUE self) {
60
65
  return self;
61
66
  }
62
67
 
63
- static VALUE hash_deep_merge(int argc, VALUE *argv, VALUE self) {
68
+ static VALUE hash_deep_merge(int argc, VALUE* argv, VALUE self) {
64
69
  VALUE other;
65
70
  rb_scan_args(argc, argv, "1", &other);
66
- other = rb_funcall(other, id_to_hash, 0);
71
+ if (!RB_TYPE_P(other, T_HASH)) {
72
+ other = rb_funcall(other, id_to_hash, 0);
73
+ Check_Type(other, T_HASH);
74
+ }
67
75
  VALUE block = Qnil;
68
76
  if (rb_block_given_p()) {
69
77
  block = rb_block_proc();
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sin_deep_merge
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro
@@ -19,15 +19,15 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - ext/sin_deep_merge/extconf.rb
21
21
  - ext/sin_deep_merge/sin_deep_merge.c
22
- homepage: https://github.com/cadenza-tech/sin_deep_merge/tree/v1.0.0
22
+ homepage: https://github.com/cadenza-tech/sin_deep_merge/tree/v1.0.1
23
23
  licenses:
24
24
  - MIT
25
25
  metadata:
26
- homepage_uri: https://github.com/cadenza-tech/sin_deep_merge/tree/v1.0.0
27
- source_code_uri: https://github.com/cadenza-tech/sin_deep_merge/tree/v1.0.0
28
- changelog_uri: https://github.com/cadenza-tech/sin_deep_merge/blob/v1.0.0/CHANGELOG.md
26
+ homepage_uri: https://github.com/cadenza-tech/sin_deep_merge/tree/v1.0.1
27
+ source_code_uri: https://github.com/cadenza-tech/sin_deep_merge/tree/v1.0.1
28
+ changelog_uri: https://github.com/cadenza-tech/sin_deep_merge/blob/v1.0.1/CHANGELOG.md
29
29
  bug_tracker_uri: https://github.com/cadenza-tech/sin_deep_merge/issues
30
- documentation_uri: https://rubydoc.info/gems/sin_deep_merge/1.0.0
30
+ documentation_uri: https://rubydoc.info/gems/sin_deep_merge/1.0.1
31
31
  funding_uri: https://patreon.com/CadenzaTech
32
32
  rubygems_mfa_required: 'true'
33
33
  rdoc_options: []