William James
3/16/2006 7:12:00 PM
Pistos Christou wrote:
> forest wrote:
> > I am stuck trying to figure out how to take an array of data and
> > dynamically build a 3x3 html table from it without standard for loops.
> >
> > Here is the code in JavaScript:
> *snip*
> > Can someone point me in the right direction for how to do this. I found
> > each_index but still was at a loss.
puts %w(1 2 3 4 5 6 7 8 9).map{|x| "<td>" + x + "</td>" }.
join.gsub(/(<td.*?\/td>){3}/,"<tr>\n \\&\n</tr>\n")