Ruby the native implementation seems to hide all singleton classes in ancestor() call. But, JRuby 0.9.0 returns singleton classes.
- The output of the following
- script is different from that of
- Ruby 1.8.4
class Object
def singleton
class<<self; self; end
end
end
class Person
end
class Employee < Person
end
puts Employee.singleton.ancestors().join("\n")
Output with JRuby 0.9.0 is as follows:
#<Class:Employee>
#<Class:Person>
#<Class:Object>
Class
Module
Object
Kernel
Output with Ruby 1.8.4 is as follows:
Class
Module
Object
Kernel