On Fri, Mar 12, 2010 at 11:33 PM, Guilherme Mello <javaplayer / gmail.com> wrote: > How to create the repeat method: > > [:one, "two", 3].repeat(3) > > Result: > > [:one, :one, :one, "two", "two", "two", 3, 3, 3] > Another way maybe, class Array def repeat(num) Array.new(num,self).transpose.flatten end end p [:one,"two",3].repeat(3) #> [:one, :one, :one, "two", "two", "two", 3, 3, 3] Harry