From 8e47706b30bb519369c7bebe612177503ae7d8f3 Mon Sep 17 00:00:00 2001 From: Jared White Date: Sat, 20 Apr 2024 19:24:12 -0700 Subject: [PATCH] Fix issue where `to_h` was incorrectly mutating arrays containing hashes --- CHANGELOG.md | 4 ++++ Gemfile.lock | 2 +- lib/hash_with_dot_access.rb | 3 +-- lib/hash_with_dot_access/version.rb | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23f58a1..75f6f1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/Gemfile.lock b/Gemfile.lock index 36b1dc5..bf48796 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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/ diff --git a/lib/hash_with_dot_access.rb b/lib/hash_with_dot_access.rb index 0deddd2..e3163db 100644 --- a/lib/hash_with_dot_access.rb +++ b/lib/hash_with_dot_access.rb @@ -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 diff --git a/lib/hash_with_dot_access/version.rb b/lib/hash_with_dot_access/version.rb index fbbf9ea..d44da1e 100644 --- a/lib/hash_with_dot_access/version.rb +++ b/lib/hash_with_dot_access/version.rb @@ -1,3 +1,3 @@ module HashWithDotAccess - VERSION = "2.1.0" + VERSION = "2.1.1" end