Erubis 2.4.1 released - a fast and extensible eRuby implemen

Hi all,

I have released Erubis 2.4.1.
http://www.kuwata-lab.com/erubis/
Erubis is another eRuby implementation which is very fast and
extensible than ERB and eruby.

This is a bugfix release.

enhancements:

- |
  Add new section 'evaluate(context) v.s. result(binding)' to

user’s guide.
This section describes why Erubis::Eruby#evaluate(context) is
recommended
rather than Erubis::Eruby#result(binding).
User’s Guide > Other Topics > evaluate(context) v.s.
result(binding)
http://www.kuwata-lab.com/erubis/users-guide.06.html#topics-context-vs-binding

- |
  Add new command-line property '--docwrite={true|false}' to
  Erubis::Ejavascript.
  If this property is true then 'document.write(_buf.join(""));'

is used
as postamble and if it is false then ‘_buf.join(“”)’ is used.
Default is true for compatibility reason but it will be false in
the
future release.
(This feature was proposed by D.Dribin. Thank you.)

bugfix:

- |
  When using Erubis::Eruby#evaluate(), changing local variables in
  templates have affected to variables accessible with

TOPLEVEL_BINDING.
It means that if you change variables in templates, it is
possible to
change variables in main program.
This was a bug and is now fixed not to affect to variables in
main
program.

  ex. template.rhtml
  --------------------
  <% for x in @items %>
  item = <%= x %>
  <% end %>
  --------------------

  ex. main-program.rb
  --------------------
  require 'erubis'
  x = 10
  items = ['foo', 'bar', 'baz']
  eruby = Erubis::Eruby.new(File.read('template.rhtml'))
  s = eruby.evaluate(:items=>items)
  print s
  $stderr.puts "*** debug: x=#{x.inspect}"  #=> x="baz" (2.4.0)
                                            #=> x=10    (2.4.1)
  --------------------

- |
  PercentLineEnhancer was very slow. Now performance problem is

solved.

I saw the benchmarks on the web page. They are impressive !

It seems that Erubis can be used with rails. I have a few questions:

  1. What is the current state of this support ?
  2. How do we replace standard ERB processing with Erubis ?
  3. Why is the code executed with Erubis so much faster the ERB ? Is it
    that ERB compilation was not cached in the tests (it certainly is
    cached in Ror) ?

Thanks for the answers,

Gaspard

2007/9/25, kwatch [email protected]:

Great news! I have been able to get my apps running with erubis if
they are using actionpack <= 1.13.2, but not with actionpack 1.13.3.
Is erubis known to work w/ this version of actionpack? My problem
seems to be related to a deprecation that occured in actionpack
1.13.3.

Thanks,

Tom