[ANN] Erubis 2.5.0 released - a fast and extensible eRuby

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

Enhancements from 2.4.1:

* Ruby on Rails 2.0 support
   If you are using preprocessing, notice that _?('foo.id') will be NG
   because it contains period ('.') character.

···

--------------------
   <!-- NG in Rails 2.0 -->
   [%= link_to 'Edit', edit_user_path(_?('@user.id')) %]
   [%= link_to 'Show', @user %]
   [%= link_to 'Delete', @user, :confirm=>'OK?', :method=>:delete %]

   <!-- OK in Rails 2.0 -->
   <%= user_id = @user.id %>
   [%= link_to 'Edit', edit_user_path(_?('user_id')) %]
   [%= link_to 'Show', :action=>'show', :id=>_?('user_id') %]
   [%= link_to 'Delete', {:action=>'destroy', :id=>_?('user_id')},
                         {:confirm=>'OK?', :method=>:delete} %]
   --------------------

* (experimental)
   Rails form helper methods for preprocessing are provided.
   These helper methos are available with preprocessing.

   ex. _form.rhtml
   --------------------
    Name: <%= text_field :user, :name %>
    Name: [%= pp_text_field :user, :name %]
   --------------------

   preprocessed:
   --------------------
    Name: <%= text_field :user, :name %>
    Name: <input id="stock_name" name="stock[name]" size="30"
                 type="text" value="<%=h @stock.name%>" />
   --------------------

   Ruby code:
   --------------------
    _buf << '
    Name: '; _buf << ( text_field :stock, :name ).to_s; _buf << '
    Name: <input id="stock_name" name="stock[name]" size="30"
                 type="text" value="';
                 _buf << (h @stock.name).to_s; _buf << '" />
   ';
   --------------------

   This shows that text_filed() is called every time when rendering,
   but pp_text_filed() is called only once when loading template,
   so pp_text_field() with prepocessing is much faster than
text_field().

   See User's guide for details.
   http://www.kuwata-lab.com/erubis/users-guide.05.html#rails-formhelpers

--
regards,
makoto kuwata

Nice :smiley:

···

--
Posted via http://www.ruby-forum.com/.