From: Trans Date: 2005-10-31T01:02:08+09:00 Subject: Re: "Readability" inflation Robert Klemme wrote: > Trans wrote: > >> ary.sort_by(:foo, :bar, :wack!) > > > > Oh, those weren't method calls, there were parameters to #meth --I > > Then I guess this makes a good indication how cryptic that was... :-) > > > know Enumerable doesn't support args, but I have a module > > EnumerableArgs that does (And let me tell you that was a pain --I had > > to essentially rewrite Enumerable from scratch!) > > What do you mean by "Enumerable doesn't support args"? It's a module not a > method. What do you need those args for? A good exmaple is ObjectSpace: class << ObjectSpace include EnumerableArgs alias :each, :each_object end ObjectSpace.select(Class) { |c| c.name =~ /^S/ } You can't do this with regular Enumerable b/c you cannot pass any arguments through the enumerable methods to the underlying #each method. (Sorry if there are any bugs in the code. Ruby's not installed on my system at the moment.) T.