[Nitro] transform_template -> block

Tim Larson tim at keow.org
Mon Dec 12 16:18:19 EST 2005

On Mon, Dec 12, 2005 at 07:47:46PM +0000, Tim Larson wrote:
> Is there something like Nitro::Compiler.new.transform_template
> that instead of producing a textual chunk of code produces a
> block/lambda/whatever that can accept parameters?

Not perfect (note '@out ||='', etc.), but I have this so far:
  @@some_name = instance_eval(
      "lambda do |param1, param2|; @out ||= '';" +
    blah, blah, blah...
  }) + ";@out end"
...used later with:
  #{@@some_name.call('foo', 'bar')}

--Tim Larson

More information about the Nitro-general mailing list