deeply_enumerable 2.0.0 → 2.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: 6dc0e555ef198f9c8a08f8d3567a6ee2b3d24b06dd777617d4b41a2a1d32b4fd
4
- data.tar.gz: 7a22638bdff5ce80f5f0bcaaa3cec78e8541c5402fa3f615415528b130f3628e
3
+ metadata.gz: c47df8d3946c3b010f0af6c185ebd93a0bcf7cbb4007ddbd89d3105496dcb78c
4
+ data.tar.gz: 9c8e54ca07f94145a0efd58b5f3dab64760d4d58244b12cb520946ee0d206ee1
5
5
  SHA512:
6
- metadata.gz: 1efe5ef4b790f4e936ef616dda532c2a50d22c0e244521abd22c7df3429b45aa81537d714bed552b398b5f21d1c3e8750246feed24bb2b1b3b044c6db065625d
7
- data.tar.gz: cdaa3281558c05f8e58de0edb33912b7a939004881d7555dd70400b114422d3a35782e9f7914d31887356b03b3856ab34c28d4a7eeb23dbf1a1a267fba083046
6
+ metadata.gz: e413f4cb0fac8f72c728126fb62e0f5ade142add7aede779c25de83051e41c9d38d6ff84f9b093ef472c5edb789db02d4f82dc77582d621265faaa63d5d01a40
7
+ data.tar.gz: 9008c5e856de8a746c6be66664c59e02af8c948377bc55fde22a99628c63753e8a8601f07de1ec127eaf327f3ee28c090ca0410d363c8af1dece5a3c82b3469c
data/CHANGELOG.md CHANGED
@@ -21,6 +21,12 @@ been replaced with four clearly-named methods, and "blank" now matches Rails'
21
21
  - **"Blank" now means `blank?`, not just empty.** The `_blank` family now also
22
22
  removes `false` and blank strings (`""`, `" "`), in addition to `nil` and empty
23
23
  collections — matching Rails' `#compact_blank`.
24
+ - **A Hash's `default`/`default_proc` is no longer preserved through compaction.**
25
+ v1 mutated a `dup` (which carried the proc); v2 builds a fresh `Hash`, which has
26
+ none. This matches `Hash#reject` and Rails' `#compact_blank`, but can silently
27
+ break code relying on auto-vivification after compaction (e.g. an accumulator
28
+ `Hash.new { |h, k| h[k] = [] }`). Apply the default proc to the compacted
29
+ *result* rather than before compacting.
24
30
 
25
31
  ### Added
26
32
 
data/README.md CHANGED
@@ -93,6 +93,20 @@ blank strings (`""`, `" "`), matching Rails' `#compact_blank`. Blankness is
93
93
  determined by an internal equivalent of ActiveSupport's `Object#blank?`, so the
94
94
  gem still has **no ActiveSupport dependency**.
95
95
 
96
+ ⚠️ **`default`/`default_proc` is not preserved.** v2 returns a freshly-built
97
+ `Hash`, so a default value or proc does not survive compaction (matching
98
+ `Hash#reject` and Rails' `#compact_blank`). v1 happened to keep it because it
99
+ mutated a `dup`. If you rely on auto-vivification, apply the default proc to the
100
+ compacted *result* rather than before compacting:
101
+
102
+ ```ruby
103
+ # Fragile — the proc is dropped by compaction:
104
+ Hash.new { |h, k| h[k] = [] }.merge(value).deep_compact_blank
105
+
106
+ # Robust — compact first, then land the data in the proc-bearing Hash:
107
+ Hash.new { |h, k| h[k] = [] }.merge(value.deep_compact_blank)
108
+ ```
109
+
96
110
  ## Installation
97
111
  Add this line to your application's Gemfile:
98
112
  ```ruby
@@ -1,3 +1,3 @@
1
1
  module DeeplyEnumerable
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deeply_enumerable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - chaunce