Maxime Guilbot schrieb:
> but I still don't understand why it's working ...

Take a look to the following example.

 >>>>> Code >>>>>

require 'pp'
class Dummy
   def initialize
     @indexes = Array.new(2, 1)
   end

   def get_next
     @indexes[0] = @indexes[0]*2
     @indexes[1] = @indexes[1]*2

     @indexes
   end

   def get_next_10
     all = []
     for i in 0..9
       all << get_next
     end
     all
   end

   def show_id
     puts @indexes.object_id
   end
end
d = Dummy.new

x = d.get_next_10
puts '##### show contents #####'
pp x
puts '##### show @indexes-id #####'
d.show_id
puts '##### show ids of Array elements #####'
x.each{|e|puts e.object_id}

 >>>>> Output >>>>>

##### show contents #####
[[1024, 1024],
  [1024, 1024],
  [1024, 1024],
  [1024, 1024],
  [1024, 1024],
  [1024, 1024],
  [1024, 1024],
  [1024, 1024],
  [1024, 1024],
  [1024, 1024]]
##### show @indexes-id #####
24861230
##### show ids of Array elements #####
24861230
24861230
24861230
24861230
24861230
24861230
24861230
24861230
24861230
24861230

 >>>>> EOE >>>>>

Your original program pushes always the same object into the final array (here 
named "d", and it ist the object, "@indexes" refers to. As a temporary help 
think in "Pointers", than it shoud be clear.

Wolfgang NĂ¡dasi-Donner