Class: Hash

Inherits:
Object show all
Defined in:
lib/hash.rb

Instance Method Summary collapse

Instance Method Details

#deep_copy!(from) ⇒ Object

Raises:

  • (ArgumentError)


2
3
4
5
6
7
8
# File 'lib/hash.rb', line 2

def deep_copy!(from)
  raise ArgumentError unless from.is_a? Hash
  self.each do |h|
    h[1].deep_copy!(from[h[0]]) if h[1].is_a? Hash
    self[h[0]] = from[h[0]]
  end
end