ERB::Compiler Hack

Posted by yrashk

While trying to develop ERB -> Lilu convertor, I’ve found a funny trick for ERB::Compiler. Could be useful for somebody, but basically just a trick for fun:

1
2
3
c = ERB::Compiler.new nil
c.insert_cmd = "print %"
eval c.compile('<div id="1"><%= @hello %></div>')

returns

<div id="1">( @hello ).to_s</div>

P.S. Most probably, there will be no ERB -> Lilu convertor.