From: James Coglan Date: 2008-08-27T00:22:40+09:00 Subject: Re: Passing a block with define_method ------=_Part_4676_15541811.1219764425302 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Just did something similar to Emmanuel's suggestion, works a treat: module Continuations METHODS = {} def accepts_continuation(*args) args.each do |method_name| func = instance_method(method_name) id = func.object_id METHODS[id] = func module_eval <<-EOS def #{method_name}(*params, &block) value = Continuations::METHODS[#{id}].bind(self).call(*params) block.call(value) if block value end EOS end end end ------=_Part_4676_15541811.1219764425302--