From: James Coglan Date: 2008-09-05T18:13:01+09:00 Subject: Re: method chaining via symbols ------=_Part_53258_32115678.1220606328724 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 2008/9/5 snacktime > If this is too strange just say so. Tonight I was working with a > rails helper method which accepts several symbols as arguments which > get turned into method calls. Normally it's used on activerecord > objects, but I wanted to make it work on an array of hashes instead. > That particular approach wouldn't work without being able to call > values.first, since some of the hash values were arrays themselves, > but the rails helper expected a single array. > > So anyways I was thinking how it would work if you could do something like > this: > > send(:method1:method2:method3) > > Arguments would be passed like normal, and the argument to a chained > method would be the result of the last method call. > > Not sure I even like the idea, just curious if it's ever been discussed > before? > > Chris Not sure if these are exactly what you're talking about, but these might provide some inspiration: http://jicksta.com/posts/the-methodphitamine http://blog.jayfields.com/2008/09/ruby-recording-method-calls-and.html Both techniques allow you store store chains of method calls and replay them later on some object. ------=_Part_53258_32115678.1220606328724--