Actions
Bug #10901
closedObject#singleton_methods behaves differently depending on whether the singleton_class exists
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
Description
class Class1
def self.foo
end
end
c1 = Class1.new
instance_eigen = c1.singleton_class
p instance_eigen.singleton_methods(false)
instance_eigen.singleton_class
p instance_eigen.singleton_methods(false)
before the eigen exists, singleton_methods returns the methods on the superclass of the non existent eigen
after it's created singleton_methods returns []
The existence or non-existence of the eigen is an implementation detail that should not be exposed to the user, conceptually it always exists. So singleton_methods should treat a non existent eigen as an empty eigen, and not look to its superclass
Files
Actions
Like0
Like0Like0Like0