R
Roger Pack
would this be useful/theoretically possible?
UnboundMethod#to_proc
Thanks!
-=R
UnboundMethod#to_proc
Thanks!
-=R
would this be useful/theoretically possible?
UnboundMethod#to_proc
Thanks!
-=R
would this be useful/theoretically possible?
UnboundMethod#to_proc
Thanks!
-=R
cfp:~ > ruby a.rb
#<UnboundMethod: M#m>
42
the issues is, without binding, what is 'self' ??? once bound,
to_proc exists.
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_methodm)
p M.instance_methodm).to_proc(self).call
cfp:~ > ruby a.rb
#<UnboundMethod: M#m>
42
the issues is, without binding, what is 'self' ??? once bound,
to_proc exists.
a @http://codeforpeople.com/
bind( this ).to_procI guess you meant
p M.instance_methodm).to_proc(self).call
the issues is, without binding, what is 'self' ??? once bound, to_proc
exists.
bind( this ).to_proc
but I guess OP rather wanted
M.i_mm).to_proc.call( self )
which on a quick thought seems impossible to have :-(
Ara said:na, just have to perform the late binding in the caller's stead
cfp:~ > ruby a.rb
#<UnboundMethod: Object#m>
42
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.