From: Johan Holmberg Date: 2005-04-04T01:06:05+09:00 Subject: signleton_methods / methods / public_methods - weirdness? Hi! I was trying to find out the "class methods" of some classes. Looking in the PickAxe I found out that there are at least three methods that return almost the same thing for a class/module: Object#singleton_methods(flag) Object#public_methods(flag) Object#methods(flag) So potentially we can get six (3 * 2) different results. To find out the difference between all invocations, I ran the methods on all builitin classes/modules, and compared the result. It turned out that I actually got 4 different results: - methods(false) and singleton_methods(false) give the same result - singleton_methods(true) gives a unique result - public_methods(false) gives a unique result - methods(true) and public_methods(true) give the same result The PickAxe said that Object#public_methods was a synonym for Object#methods. This is apparently not true (or true only when the argument is "true"). To me it seem like these methods have "degenerated" into something that is almost impossible to explain. Neither the PickAxe nor the online-docs explains it in a way so I can understand the differences. Can anyone explain the logic behind these different methods and their results? Maybe I'm just stupid :) /Johan Holmberg