aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2019-07-25 23:34:02 +0200
committerKasper Timm Hansen <kaspth@gmail.com>2019-07-25 23:34:02 +0200
commit04093884a1527777795ad1f17ef1c556e7db9429 (patch)
tree095d56549d9f2c26dfb14b4b1caa7f7d3f57e56b /activesupport
parent64a430129fbec2320054a8fc85672994f38a9ee0 (diff)
downloadrails-04093884a1527777795ad1f17ef1c556e7db9429.tar.gz
rails-04093884a1527777795ad1f17ef1c556e7db9429.tar.bz2
rails-04093884a1527777795ad1f17ef1c556e7db9429.zip
Fixup 64a430129f
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/hash_with_indifferent_access.rb8
1 files changed, 5 insertions, 3 deletions
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