# Erubis 2.4.1 released - a fast and extensible eRuby implemen

**URL:** <https://www.ruby-forum.com/t/erubis-2-4-1-released-a-fast-and-extensible-eruby-implemen/115413>\
**Category:** Ruby\
**Created:** [September 25, 2007, 1:36am UTC](https://www.ruby-forum.com/t/erubis-2-4-1-released-a-fast-and-extensible-eruby-implemen/115413 "2007-09-25T01:36:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kwatch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/76d3ee/32.png) [@kwatch](https://www.ruby-forum.com/u/kwatch)\
**Post date:** [September 25, 2007, 1:36am UTC](https://www.ruby-forum.com/t/erubis-2-4-1-released-a-fast-and-extensible-eruby-implemen/115413/1 "2007-09-25T01:36:46Z")

</div>

Hi all,

I have released Erubis 2.4.1.  
[http://www.kuwata-lab.com/erubis/](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](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.

---

<div class="post-metadata">

**Author:** ![kwatch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/76d3ee/32.png) [@kwatch](https://www.ruby-forum.com/u/kwatch)\
**Post date:** [September 25, 2007, 9:10am UTC](https://www.ruby-forum.com/t/erubis-2-4-1-released-a-fast-and-extensible-eruby-implemen/115413/2 "2007-09-25T09:10:26Z")

</div>

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 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![kwatch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/76d3ee/32.png) [@kwatch](https://www.ruby-forum.com/u/kwatch)\
**Post date:** [September 25, 2007, 2:31pm UTC](https://www.ruby-forum.com/t/erubis-2-4-1-released-a-fast-and-extensible-eruby-implemen/115413/3 "2007-09-25T14:31:24Z")

</div>

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
