Working with Frozen Hashes

I discovered a cool method today while working with a frozen hash containing a frozen array. deep_dup From the Rails API Documentation: Returns a deep copy of hash. hash = { a: { b: 'b' } } dup = hash.deep_dup dup[:a][:c] = 'c' hash[:a][:c] # => nil