On 1/19/07, James Earl <[EMAIL PROTECTED]> wrote: > Hi, I thought it would be fun to try to write a render method that > uses erb for rending. I'm not much of a programmer, but I still like > to try: > > module Test > require 'erb' > def render(m) > ERB.new(IO.read("templates/layout.html")).result(binding) do > ERB.new(IO.read("templates/#{m}.html")).result(binding) > end > end > end
Replying to myself... this works, instead of using yield. Not very pretty I know :) module Test require 'erb' def render(m) content=ERB.new(IO.read("templates/#{m}.html")).result(binding) layout=ERB.new(IO.read("templates/layout.html")).result(binding) end end _______________________________________________ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list