[1..5] is an array with one element - a range object, all attempts to iterate through it will fail. An array can have many kinds of objects. In my example above, I see a range as just a range and make any array out of it.
1.9.3-p125 :008 > (1..5).to_a
To more accurately say what you indicated - starting with [1..5] - you could do:
1.9.3-p125 :013 > newarray = [] 1.9.3-p125 :014 > [1..5][0].each {|e| newarray << e} => 1..5 1.9.3-p125 :015 > newarray => [1, 2, 3, 4, 5] 1.9.3-p125 :016 >
source share