From: Pat Nakajima Date: 2008-11-23T14:05:54+09:00 Subject: Re: wish list item: Method#to_proc On Nov 22, 8:52 pm, "ara.t.howard" wrote: > On Nov 22, 2008, at 4:22 PM, Roger Pack wrote: > > > would this be useful/theoretically possible? > > UnboundMethod#to_proc > > Thanks! > > -=R > > cfp:~ > cat a.rb > class UnboundMethod >    def to_proc this = self >      bind(self).to_proc >    end > end > > module M >    def m >      42 >    end > end > > include M > > p M.instance_method(:m) > > p M.instance_method(:m).to_proc(self).call > > cfp:~ > ruby a.rb > # > 42 > > the issues is, without binding, what is 'self' ???  once bound,   > to_proc exists. > > a @http://codeforpeople.com/ > -- > we can deny everything, except that we have the possibility of being   > better. simply reflect on that. > h.h. the 14th dalai lama The main issue with this approach is that instances of UnboundMethod can only be bound to objects of the same class on which the method was originally defined. That's why I used Ruby2Ruby.