Skip to content

Commit 8e47706

Browse files
committed
Fix issue where to_h was incorrectly mutating arrays containing hashes
1 parent da37aa7 commit 8e47706

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [2.1.1] - 2024-04-20
4+
5+
- Fix issue where `to_h` was incorrectly mutating arrays containing hashes
6+
37
## [2.1.0] - 2024-04-20
48

59
- Adds conversion back to a hash with `to_h` and `to_dot_h` for enumeration.

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
hash_with_dot_access (2.1.0)
4+
hash_with_dot_access (2.1.1)
55

66
GEM
77
remote: https://rubygems.org/

lib/hash_with_dot_access.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ def self.primitive_value(value)
1919
when ::Hash
2020
value.to_h
2121
when Array
22-
value = value.dup if value.frozen?
23-
value.map! { primitive_value(_1) }
22+
value.map { primitive_value(_1) }
2423
else
2524
value
2625
end

lib/hash_with_dot_access/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module HashWithDotAccess
2-
VERSION = "2.1.0"
2+
VERSION = "2.1.1"
33
end

0 commit comments

Comments
 (0)