Skip to content

Commit

Permalink
Fix issue where to_h was incorrectly mutating arrays containing hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcwhite committed Apr 21, 2024
1 parent da37aa7 commit 8e47706
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [2.1.1] - 2024-04-20

- Fix issue where `to_h` was incorrectly mutating arrays containing hashes

## [2.1.0] - 2024-04-20

- Adds conversion back to a hash with `to_h` and `to_dot_h` for enumeration.
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
hash_with_dot_access (2.1.0)
hash_with_dot_access (2.1.1)

GEM
remote: https://rubygems.org/
Expand Down
3 changes: 1 addition & 2 deletions lib/hash_with_dot_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ def self.primitive_value(value)
when ::Hash
value.to_h
when Array
value = value.dup if value.frozen?
value.map! { primitive_value(_1) }
value.map { primitive_value(_1) }
else
value
end
Expand Down
2 changes: 1 addition & 1 deletion lib/hash_with_dot_access/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module HashWithDotAccess
VERSION = "2.1.0"
VERSION = "2.1.1"
end

0 comments on commit 8e47706

Please sign in to comment.