From: Max Williams Date: 2007-11-02T21:05:57+09:00 Subject: Get only the non-inherited methods of a class Does anyone know how to get the methods of a class in such a way as to *not* get inherited ones? For example, the Rails class AbstractRequest has 20 or so methods, all of which can be called with no parameters. I can call them all, displaying the name of the method, and the result of calling it with an empty parameter list, with request.class.methods.each do |m| method = request.class.method(m) puts " #{m} = #{method.call}, " end This would produce accepts = text/htmlapplication/xmlimage/pngtext/plain*/* delete? = false etc However, calling the above also gets all the inherited methods as well, many of which require parameters, and the code breaks because i'm not supplying them. Is there some sort of test that i can do to see if a class creates a method, rather than inheriting it? I'm thinking of possible solutions, like recursing up the superclass chain, and not calling the method if any superclass responds to it, but this seems very complicated for such a simple problem. Any ideas, anyone? thanks max -- Posted via http://www.ruby-forum.com/.