You can use the fill method in the Array class

e.g from the Ruby docs

   a.fill("z", 2, 2)        #=> ["x", "x", "z", "z"]
   a.fill("y", 0..1)        #=> ["y", "y", "z", "z"]

Please refer to the Ruby docs for other ways to use the fill method

http://railsapi.com/doc/ruby-v1.9.2/classes/Array.html#M000097

-- 
Posted via http://www.ruby-forum.com/.