Create array of n items based on integer value

You can just splat a range:

[*1..10]
#=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Ruby 1.9 allows multiple splats, which is rather handy:

[*1..3, *?a..?c]
#=> [1, 2, 3, "a", "b", "c"]

yet another tricky way:

> Array.new(10) {|i| i+1 }
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]