When you type [1..10]
, what you actually have is an Array containing a single Range object. If you want an array of FixNums, you actually drop the []
s and call to_a
on the range itself:
irb(main):006:0> x = (1..10).to_a
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]