aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorJames Blanding <james@basicsgroup.com>2014-05-30 19:40:53 -0400
committerJames Blanding <james@basicsgroup.com>2014-05-30 19:40:53 -0400
commitf803b82a771a9aed33458760cc99415f8c63ab78 (patch)
tree7dd90142f1639fc0d783a855e308688cb9b09904 /activesupport/lib/active_support
parent2c51c405e0eb75a1c3acc7f1ec0da4d4ee90cb30 (diff)
downloadrails-f803b82a771a9aed33458760cc99415f8c63ab78.tar.gz
rails-f803b82a771a9aed33458760cc99415f8c63ab78.tar.bz2
rails-f803b82a771a9aed33458760cc99415f8c63ab78.zip
HashWithIndifferentAccess#dup doc [ci skip]
The phrase "exact copy" in the existing docmentation is somewhat misleading.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/hash_with_indifferent_access.rb9
1 files changed, 8 insertions, 1 deletions
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