Forum: Ruby Re: Question about BlankSlate.reveal

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Gregory B. (Guest)
on 2009-01-25 18:28
(Received via mailing list)
On Sun, Jan 25, 2009 at 5:30 AM, Gregory B.
<removed_email_address@domain.invalid> 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:

>        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
Robert K. (Guest)
on 2009-01-28 12:25
(Received via mailing list)
2009/1/25 Gregory B. <removed_email_address@domain.invalid>:
> On Sun, Jan 25, 2009 at 5:30 AM, Gregory B.
> <removed_email_address@domain.invalid> 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:

> 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.

Greg, thanks for sharing the result of your investigation!

Kind regards

robert
This topic is locked and can not be replied to.