From: Gregory Brown Date: 2009-01-26T01:25:51+09:00 Subject: Re: Question about BlankSlate.reveal [SOLVED] On Sun, Jan 25, 2009 at 5:30 AM, Gregory Brown wrote: As it turns out, I was able to stop the method from binding to a single instance without re-binding on every call. I simply changed this code: > ### Code pulled from blankslate.rb in the builder gem. > > # Redefine a previously hidden method so that it may be called on a blank > # slate object. > def reveal(name) > bound_method = nil > unbound_method = find_hidden_method(name) > fail "Don't know how to reveal method '#{name}'" unless unbound_method > define_method(name) do |*args| > bound_method ||= unbound_method.bind(self) > bound_method.call(*args) > end > end > end So that instead, it passed the UnboundMethod directly to define_method. This does what I want and seems reasonable. Please let me know if there are problems, otherwise, I'm a happy camper now. :) def reveal(name) unbound_method = find_hidden_method(name) fail "Don't know how to reveal method '#{name}'" unless unbound_method define_method(name, unbound_method) end -greg -- Technical Blaag at: http://blog.majesticseacreature.com Non-tech stuff at: http://metametta.blogspot.com "Ruby Best Practices" Book now in O'Reilly Roughcuts: http://rubybestpractices.com