method
dup
v4.2.1 -
Show latest stable
- Class:
ActiveSupport::HashWithIndifferentAccess
dup()public
Returns a shallow copy of the hash.
hash = ActiveSupport::HashWithIndifferentAccess.new({ a: { b: 'b' } }) dup = hash.dup dup[:a][:c] = 'c' hash[:a][:c] # => nil dup[:a][:c] # => "c"