From: Belorion Date: 2005-01-13T01:18:50+09:00 Subject: Re: Webrick, erb, and .rhtml Thank you for the quick response! Does there exist Webrick support for handling .rhtml files the way eruby/mod_ruby does? Matt On Thu, 13 Jan 2005 01:12:55 +0900, David A. Black wrote: > Hi -- > > On Thu, 13 Jan 2005, Belorion wrote: > > > Serving up html works fine. However, serving up .rhtml does not work. > > If I visit my test.rhtml, whose contents are: > > > > > > testing, 1234 > > <% > > 10.times{ |i| puts i } > > %> > > > > > > All I get as output on my browser is "testing, 1234", whose source looks like > > > > testing, 1234 > > > > > > At the command prompt, if I ruby "erb test.rhtml" I get: > > > > 0 > > 1 > > 2 > > 3 > > 4 > > 5 > > 6 > > 7 > > 8 > > 9 > > > > > > > > > > testing, 1234 > > > > > > > > > > > > Which is obviously incorrect. What am I doing wrong here? I am using > > ruby 1.8.2 (2004-07-29), and erb 2.0.4. > > You need <%= %> rather than <% %>. But keep in mind that what erb > will show you is the result of evaluating the expression. The result > of evaluating 10.times {...} is 10 -- and the result of evaluating > puts is nil. So if you want to display all the numbers, you'd want > something like: > > <%= (1..10).to_a.join(", ") %> > > David > > -- > David A. Black > dblack@wobblini.net > >