everythingrb 0.8.1 → 0.8.2

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: 690fd1806244edcbfb5eb400b41c03f469395dd60b4aae710525f0deaee74987
4
- data.tar.gz: eb30c2bf26c9a760d44a5615c7469ee3217b077129e4d703d12072ed5518772c
3
+ metadata.gz: f1dea4517af697abde3f07ffb40d62a7ec40b3f8c0b91cc74eb93edde92e5aac
4
+ data.tar.gz: bb3888fac39b4d3138ddfb5f7d36504d3df28c274b4d9a950772aca0c5d5f0fc
5
5
  SHA512:
6
- metadata.gz: a3b3fd079bceec53d996894600edf5cedd3160eb2ae3e6936b1ee7d0912f44b1f49fd17365bc718f994c9a741a5c343cddafdb6a0d26eec48ab72025ceb4e8d6
7
- data.tar.gz: 57cf9aa688a17360d4f77be95a225c94df7cfbb5acb39efa060abaf8b4d02a96f3315d9e0a4f5273cbc92e0eb7931cf4a28f453e0491ac4f7db146882ae13e17
6
+ metadata.gz: 341bf18d8e774f882b01b5ab50a7d262d113ecdbefab288c4e373cc6bb89b9f86a3ddf8a67d7a842016e6f62d04816db136c658106cf11685c50bd7d35693264
7
+ data.tar.gz: d7d3f73c40cec2555958de71452af51945f681d7e9731edc477c6428e316e71c607e22d00abd9257a1b4dd6ee0be0ee33b067a745c996593109621251464c8ea
data/CHANGELOG.md CHANGED
@@ -15,6 +15,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
15
15
  ### Removed
16
16
  -->
17
17
 
18
+ ## [0.8.2] - 12025-05-25
19
+
20
+ ### Added
21
+
22
+ ### Changed
23
+
24
+ - Fixed `Hash#rename_key_unordered` and `Hash#rename_key_unordered!` to not create new key-value pairs when the original key doesn't exist. Previously, these methods would incorrectly add the `new_key` to the hash even when `old_key` was missing.
25
+
26
+ ### Removed
27
+
18
28
  ## [0.8.1] - 12025-05-21
19
29
 
20
30
  ### Added
@@ -291,7 +301,8 @@ This change aligns our method signatures with Ruby's conventions and matches our
291
301
 
292
302
  - Added alias `each` to `each_pair` in OpenStruct for better enumerable compatibility
293
303
 
294
- [unreleased]: https://github.com/itsthedevman/everythingrb/compare/v0.8.1...HEAD
304
+ [unreleased]: https://github.com/itsthedevman/everythingrb/compare/v0.8.2...HEAD
305
+ [0.8.2]: https://github.com/itsthedevman/everythingrb/compare/v0.8.1...v0.8.2
295
306
  [0.8.1]: https://github.com/itsthedevman/everythingrb/compare/v0.8.0...v0.8.1
296
307
  [0.8.0]: https://github.com/itsthedevman/everythingrb/compare/v0.7.0...v0.8.0
297
308
  [0.7.0]: https://github.com/itsthedevman/everythingrb/compare/v0.6.1...v0.7.0
data/README.md CHANGED
@@ -12,11 +12,15 @@ We've all been there - writing the same tedious patterns over and over:
12
12
 
13
13
  ```ruby
14
14
  # BEFORE
15
- users = [{ name: "Alice", role: "admin" }, { name: "Bob", role: "user" }]
15
+ users = [
16
+ { name: "Alice", role: "admin" },
17
+ { name: "Bob", role: "user" },
18
+ { name: "Charlie", role: "admin" }
19
+ ]
16
20
  admin_users = users.select { |u| u[:role] == "admin" }
17
21
  admin_names = admin_users.map { |u| u[:name] }
18
22
  result = admin_names.join(", ")
19
- # => "Alice"
23
+ # => "Alice, Charlie"
20
24
  ```
21
25
 
22
26
  With EverythingRB, you can write code that actually says what you mean:
@@ -24,7 +28,7 @@ With EverythingRB, you can write code that actually says what you mean:
24
28
  ```ruby
25
29
  # AFTER
26
30
  users.join_map(", ") { |u| u[:name] if u[:role] == "admin" }
27
- # => "Alice"
31
+ # => "Alice, Charlie"
28
32
  ```
29
33
 
30
34
  *Methods used: [`join_map`](https://itsthedevman.com/docs/everythingrb/Array.html#join_map-instance_method)*
@@ -629,6 +629,10 @@ class Hash
629
629
  # But as the hash becomes larger, the performance improvements become diminished until they're roughly the same.
630
630
  # Neat!
631
631
  hash = except(old_key)
632
+
633
+ # Only modify the hash if the old key exists
634
+ return hash unless key?(old_key)
635
+
632
636
  hash[new_key] = self[old_key]
633
637
  hash
634
638
  end
@@ -650,6 +654,9 @@ class Hash
650
654
  # # => {a: 1, c: 3, middle: 2} # Order may differ
651
655
  #
652
656
  def rename_key_unordered!(old_key, new_key)
657
+ # Only modify the hash if the old key exists
658
+ return self unless key?(old_key)
659
+
653
660
  self[new_key] = delete(old_key)
654
661
  self
655
662
  end
@@ -7,5 +7,5 @@
7
7
  #
8
8
  module Everythingrb
9
9
  # Current version of the everythingrb gem
10
- VERSION = "0.8.1"
10
+ VERSION = "0.8.2"
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: everythingrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-21 00:00:00.000000000 Z
11
+ date: 2025-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ostruct