From: Shashank Date Date: 2004-10-30T21:43:58+09:00 Subject: Re: reuse passed proc later? Hi, David Gurba wrote: > I want to do the following (with as little modfication as necessary): > > call a passed block to a function at some later time... Eg. > > class A > > def foo(&block) > @func = block > end > end > > a = A.new > num = a.func.call { print "12" } > > ..but func is an unknown method, and attr_accessor :func doesn't help either.... > > any nice solution? Did you mean to do this: class A attr_accessor :func def foo(&block) @func = block end end a = A.new a.foo { print "12" } a.func.call __END__ HTH, -- shanko