From: Simon Strandgaard <0bz63fz3m1qt3001@...> Date: 2003-06-07T04:06:24+09:00 Subject: Re: RUBY, CGI and objectts On Sat, 07 Jun 2003 04:27:32 +0900, Steven Ketcham wrote: > Perhaps I'm doing this wrong? > > I get 12345 - no cell tags. > > def doResult() > row = [ 1, 2, 3, 4, 5 ] > @cgi.out{ > @cgi.head{ "\n"+@cgi.title{"Test"} } + > @cgi.body{ > @cgi.h1 { "Test" } + > @cgi.table ('BORDER' => '1') { > @cgi.tr { row.each { |cell| @cgi.td {"#{cell}"} } } > } # table > } # body > } > end You are not 'plus'ing the elements. try this: > cat xxx.rb require "cgi" cgi = CGI.new("html3") # add HTML generation methods cgi.out() do cgi.html() do cgi.head{ cgi.title{"TITLE"} } + cgi.body() do cgi.table do cgi.tr do res = "" [1, 2, 3, 4].each { |col| res += cgi.td {"#{col}"} } res end end end end end > ruby xxx.rb x Content-Type: text/html Content-Length: 178 TITLE
1234
> -- Simon Strandgaard