From: Joel VanderWerf Date: 2003-01-23T09:22:22+09:00 Subject: Re: Enumerable hacks Martin DeMello wrote: > Generalising the two methods in > http://www.rubygarden.org/ruby?StandardClassExtensions/Enumerable > > Not as cool as using method_missing, but a lot more extensible :) It's pretty cool, and probably more efficient. Some minor optimizations: > def #{meth.to_s}_with_index(*args, &block) def #{meth}_with_index(*args) > block.call(n,i) yield(n,i) # yield is more efficient than making a Proc