On Sun, Jan 9, 2011 at 1:53 PM, Loren Segal <lsegal / soen.ca> wrote:
> FWIW I've implemented something similar a while back as a gem called
> "force_bind". You call .force_bind on an UnboundMethod instead of bind.
>
> https://rubygems.org/gems/force_bind
>
> Although it would be great to see #bind (and define_method) support this out
> of the box, adding this behaviour through a gem isn't *so* bad.

JRuby has shipped this feature since 2006 or so, called
JRubyExtensions.steal_method(target, source, :name). We originally did
it because we needed only some methods from ActiveRecord on our hacked
adapters around JDBC. I'm unsure if it's used anymore.

- Charlie