Actions
Bug #11980
closedExternal methods are appearing as instance methods for String
Bug #11980:
External methods are appearing as instance methods for String
Actions
Added by danielpclark (Daniel P. Clark) over 10 years ago. Updated about 7 years ago.
Those results were from IRB. Here's my results from a Ruby script.
"test_scope_creep.rb"
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:
It appears they are defined as private methods when run via ruby and in irb they run like they're not private methods.