On Saturday 22 July 2006 00:20, Peter Michaux wrote: > On 7/21/06, Michael Schuerig <[EMAIL PROTECTED]> wrote: > > On Friday 21 July 2006 21:27, Peter Michaux wrote: > > > It is easy to write native JavaScript versions of code written > > > using the Prototype.js enumerable methods. I've given a few > > > examples. It is obvious that the native versions are much more > > > efficient and have other benefits. Why not just write native from > > > the start? > > > > If I'm not mistaken the enumerable methods exist partly to make the > > job of the Rails JavaScriptGenerator easier (although the > > Prototype.js implementation of them predates the > > JavaScriptGenerator). The JavaScriptGenerator translates a subset > > of Ruby into JavaScript so that RJS templates can be written > > entirely in Ruby. > > I have looked through the JavaScriptGenerator in resonable detail > over the last couple days. I don't know about the <<, [], or show > methods yet but all the other rjs methods do not need the enumerable > stuff. Do you have an example?
Have a look (in edge rails) at JavaScriptCollectionProxy#method_missing. This method relies on there being JS equivalents for the Ruby enumerable methods. Michael -- Michael Schuerig mailto:[EMAIL PROTECTED] http://www.schuerig.de/michael/ _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs