# Erubis 2.3.0 released - a fast and extensible eRuby implemen

**URL:** <https://www.ruby-forum.com/t/erubis-2-3-0-released-a-fast-and-extensible-eruby-implemen/104836>\
**Category:** Ruby\
**Created:** [May 23, 2007, 3:46am UTC](https://www.ruby-forum.com/t/erubis-2-3-0-released-a-fast-and-extensible-eruby-implemen/104836 "2007-05-23T03:46:54Z")\
**Posts on this page:** 1\
**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:** [May 23, 2007, 3:46am UTC](https://www.ruby-forum.com/t/erubis-2-3-0-released-a-fast-and-extensible-eruby-implemen/104836/1 "2007-05-23T03:46:54Z")

</div>

Hi all,

I have just released Erubis 2.3.0.  
Erubis is another implementation of eRuby and it gives more speed  
to Ruby on Rails application.  
[http://www.kuwata-lab.com/erubis](http://www.kuwata-lab.com/erubis)  
[http://www.kuwata-lab.com/erubis/CHANGES](http://www.kuwata-lab.com/erubis/CHANGES)

Features:

- Very fast, almost three times faster than ERB and  
even ten percent faster than eruby (implemented in C)
- File caching of converted Ruby script support, which  
makes eRuby about 40-50 percent faster.
- Support multi-language  
(Ruby,PHP,C,Java,Scheme,Perl,Javascript)
- Auto escaping support
- Auto trimming spaces around ‘\<% %\>’
- Embedded pattern changeable (default ‘\<% %\>’)
- Context object available and easy to combine eRuby  
template with YAML datafile or Ruby script
- Easy to extend in subclass
- Ruby on Rails support
- Mod\_ruby support

Installation is very easy.  
.\* Just type ‘gem install -r erubis’ if you have installed RubyGems.  
.\* Or download erubis\_2.3.0.tar.bz2 and type ‘ruby setup.rb’.

See users’ guide (erubis\_2.3.0/doc/users-guide.html)  
for details.

Enhancements:

- New class ‘Erubis::FastEruby’ is added.  
It is a subclass of Erubis::Eruby and includes  
InterpolationEnhancer.  
Erubis::FastEruby is compatible with and faster than  
Erubis::Eruby.

- 
## New enhancer ‘InterpolationEnhancer’ is added. This enhancer uses expression interpolation to eliminate method call of String#\<\<. In the result, this enhancer makes Eruby a little faster.

## Assume that input is ‘\<%=name%\>’.

## Eruby convert input into the following code. String#\<\< is

called 5 times.  
\_buf \<\< ‘’; \_buf \<\<  
(name).to\_s; \_buf \<\< ‘’;

```
  ## When InterpolationEnhancer is used, String#<< is called only

```

once.  
\_buf \<\< %Q`<a href="#{url}">#{name}</a>`;  
--------------------

- 
# New enhancer ‘ErboutEnhancer’ is added. ErboutEnhancer set ‘\_erbout’ as well as ‘\_buf’ to be compatible with ERB.

$ cat ex.rhtml

Hello

 $ erubis -x ex.rhtml \_buf = ''; \_buf \<\< '

Hello

 '; \_buf.to\_s $ erubis -xE Erbout ex.rhtml \_erbout = \_buf = ''; \_buf \<\< '

Hello

 '; \_buf.to\_s ====================
- 
# [experimental] New enhancer ‘DeleteIndentEnhancer’ is added. This enhancer deletes indentation of HTML file.

$ cat ex.rhtml

 \<% for item in ['AAA', 'BBB', 'CCC'] %\> - \<%= item %\>
 \<% end %\> 

 $ erubis ex.rhtml 

  - AAA
  - BBB
  - CCC

 $ erubis -E DeleteIndent ex.rhtml 

  - AAA
  - BBB
  - CCC

 ====================
- Mod\_ruby is supported (very thanks to Andrew R Jackson!).  
See users-guide and ‘contrib/erubis-run.rb’ for details.

- New command-line option ‘-X’, ‘-N’, ‘-U’, and ‘-C’ are added.  
These are intended to be a replacement of ‘notext’ command.  
= ‘-X’ shows only ruby statements and expressions.  
= ‘-N’ adds line numbers.  
= ‘-U’ compress empty lines into a line.  
= ‘-C’ removes empty lines.

Changes:

- 
## ‘helpers/rails\_helper.rb’ is changed to use ErboutEnhancer. The following is an examle to use Erubis with Ruby on Rails. File ‘config/environment.rb’:

## require ‘erubis/helpers/rails\_helper’ #Erubis::Helpers::RailsHelper.engine\_class = Erubis::Eruby # or Erubis::FastEruby #Erubis::Helpers::RailsHelper.init\_properties = {} #Erubis::Helpers::RailsHelper.show\_src = false # set true for debugging
- Command ‘notext’ has been removed. Use ‘-X’, ‘-N’, ‘-U’, and ‘-C’  
instead.

- Tab characters in YAML file are expaneded automatically.  
If you want not to expand tab characters, add command-line optio ‘-  
T’.

- Benchmark scripts (benchmark/bench.\*) are rewrited.

- Users-guide (doc/users-guide.html) is updated.

Have fun!
