From: gabriele renzi Date: 2004-06-28T19:18:03+09:00 Subject: Re: Maybe IRB Bug? il Mon, 28 Jun 2004 19:03:16 +0900, Mauricio Fern�ndez ha scritto:: >On Mon, Jun 28, 2004 at 06:52:57PM +0900, gabriele renzi wrote: >> >> a.sort_by &(Array.instance_method(:size)) >> TypeError: wrong argument type UnboundMethod (expected Proc) > >Florian Gro� (flgr) thought of using #to_proc some time ago, something >like: yuk, thanks, I remember the trick. But I was more in the mood of providing a method like this: ary.sort_by &getter(:size) This has the advantage that #getter could accept some parameters and return a more refined proc. Note that this does not actually save typing :) But to say the truth, I just dislike typing argument in blocks two times, like do |x| x.foo end I think I'll be happy with something like a 'default parameter' (say, grovy has 'it' for this). Not that important, anyway.