Issue #11980 has been updated by Daniel P. Clark.


It's not just String.

~~~ruby
Array.instance_method(:a).owner
# => Object
~~~


----------------------------------------
Bug #11980: External methods are appearing as instance methods for String
https://bugs.ruby-lang.org/issues/11980#change-56061

* Author: Daniel P. Clark
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.3.0
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
It appears we're having methods creep into the String scope.

~~~ruby
"".methods.count
# => 170

defined? "".a
# => nil

def a
 "foo"
end

"".methods.count
# => 171

defined? "".a
# => "method"

"bar".a
# => "foo"
~~~



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>