From f803b82a771a9aed33458760cc99415f8c63ab78 Mon Sep 17 00:00:00 2001 From: James Blanding Date: Fri, 30 May 2014 19:40:53 -0400 Subject: HashWithIndifferentAccess#dup doc [ci skip] The phrase "exact copy" in the existing docmentation is somewhat misleading. --- activesupport/lib/active_support/hash_with_indifferent_access.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index a4ebdea598..ed41b28d54 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -176,7 +176,14 @@ module ActiveSupport indices.collect { |key| self[convert_key(key)] } end - # Returns an exact copy of the hash. + # Returns a shallow copy of the hash. + # + # hash = ActiveSupport::HashWithIndifferentAccess.new({ a: { b: 'b' } }) + # dup = hash.dup + # dup[:a][:c] = 'c' + # + # hash[:a][:c] #=> "c" + # dup[:a][:c] #=> "c" def dup self.class.new(self).tap do |new_hash| new_hash.default = default -- cgit v1.2.3