From 04093884a1527777795ad1f17ef1c556e7db9429 Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Thu, 25 Jul 2019 23:34:02 +0200 Subject: Fixup 64a430129f --- activesupport/lib/active_support/hash_with_indifferent_access.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index e1d233e208..6acf64cb39 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -368,17 +368,19 @@ module ActiveSupport end def convert_value(value, for: nil) # :doc: + conversion = binding.local_variable_get(:for) + if value.is_a? Hash - if binding.local_variable_get(:for) == :to_hash + if conversion == :to_hash value.to_hash else value.nested_under_indifferent_access end elsif value.is_a?(Array) - if binding.local_variable_get(:for) != :assignment || value.frozen? + if conversion != :assignment || value.frozen? value = value.dup end - value.map! { |e| convert_value(e, options) } + value.map! { |e| convert_value(e, for: conversion) } else value end -- cgit v1.2.3