From: "nobu (Nobuyoshi Nakada)" <nobu@...>
Date: 2013-05-26T22:21:41+09:00
Subject: [ruby-core:55167] [ruby-trunk - Feature #4254] Allow method transplanting


Issue #4254 has been updated by nobu (Nobuyoshi Nakada).


saturnflyer (Jim Gay) wrote:
> The specs fail on ruby-head ((<URL:https://travis-ci.org/saturnflyer/casting/jobs/7432959>)) but pass for 2.0 ((<URL:https://travis-ci.org/saturnflyer/casting/jobs/7432957>))

From your "ruby-head" log:

  $ ruby --version
  ruby 2.0.0dev (2012-12-12) [x86_64-linux]

It's too old.

----------------------------------------
Feature #4254: Allow method transplanting
https://bugs.ruby-lang.org/issues/4254#change-39532

Author: zimbatm (Jonas Pfenniger)
Status: Closed
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: 2.0.0


=begin
Is there a technical reason to not allow re-binding a method from one module to any other module ?
 
  module M
    def foo; "foo"; end
  end

  module N; end
  N.send(:define_method, :foo, M.instance_method(:foo)) #=> should not raise
 
It's like monkey-patching. Powerful, dangerous, but also really useful. It could allow different variations of method_wrap or alias_method_chain that are not possible right now.
=end



-- 
http://bugs.ruby-lang.org/