[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

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

Makoto Kuwata

1/30/2008 3:14:00 PM

I have released Erubis 2.5.0.
http://www.kuwata-lab.c...
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.c...users-guide.05.html#rails-formhelpers


--
regards,
makoto kuwata

1 Answer

Marc Heiler

1/30/2008 7:50:00 PM

0

Nice :D
--
Posted via http://www.ruby-....