I've been stuck on this for a while. As an assignment I need to transpose this 2D array without using the built in transpose method, and without altering the function name / output. I feel like it should be way easier than I'm making it out to be...
class Image def transpose @array.each_with_index do |row, row_index| row.each_with_index do |column, col_index| @array[row_index] = @array[col_index] end end end endimage_transpose = Image.new([[1, 2, 3],[4, 5, 6],[7, 8, 9]])print "Image transpose"putsimage_transpose.output_imageputs "-----"image_transpose.transposeimage_transpose.output_imageputs "-----"