Class: Array

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

Instance Method Summary collapse

Instance Method Details

#deep_copy!(from) ⇒ Object

Raises:

  • (ArgumentError)


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

def deep_copy!(from)
  raise ArgumentError unless from.is_a? Array
  self.each_with_index do |item, index|
    item.deep_copy!(from[index]) if item.is_a? Array
    self[index] = from[index]
  end
end