Ruby newbie here... I want to apply Array.map! to an element of a 2D array, but doing something like the example below applies map to every element of the array.
array = Array.new(3, Array.new(3, 0))
array[2].map! { |e| e + 1 }
print array
This gives me [[1, 1, 1], [1, 1, 1], [1, 1, 1]]
whereas I want something more like [[0, 0, 0], [0, 0, 0], [1, 1, 1]]
.