From: 6ftdan@... Date: 2016-01-12T12:48:10+00:00 Subject: [ruby-core:72822] [Ruby trunk - Bug #11980] External methods are appearing as instance methods for String Issue #11980 has been updated by Daniel P. Clark. Those results were from IRB. Here's my results from a Ruby script. "test_scope_creep.rb" ~~~ruby puts "".methods.count puts defined? "".a def a "foo" end puts "".methods.count puts defined? "".a puts String.private_method_defined? :a puts String.instance_method(:a).owner puts [].send :a puts Array.private_method_defined? :a puts Array.instance_method(:a).owner puts [].send :a ~~~ Output: ~~~ 170 170 true Object foo true Object foo ~~~ It appears they are defined as private methods when run via `ruby` and in `irb` they run like they're not private methods. ---------------------------------------- Bug #11980: External methods are appearing as instance methods for String https://bugs.ruby-lang.org/issues/11980#change-56062 * 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: