At 15:28 27/04/2004 +0900, you wrote:
>On Apr 25, 2004, at 12:06 PM, Joel VanderWerf wrote:
>>Mark Hubbart wrote:
>>>     (obj.methods - Object.new.methods).sort
>>>I added that to my .irbrc file  defined as Object#less_methods.
>>You can use Object.instance_methods instead, since
>>   Object.instance_methods == Object.new.methods
>>Maybe this would be convenient:
>>class Object
>>   def less_methods(cl=Object)
>>     methods - cl.instance_methods
>>   end
>>end
>Great idea :) a quick hack now has turned into something better:
>class Object
>   def less_methods(klass = Object)
>     (methods - klass.instance_methods).sort
>   end
>end
>class Class
>   def less_methods(klass = Class)
>     (methods - klass.methods).sort
>   end
>end
>class Module
>   def less_methods
>     (methods - Module.methods).sort
>   end
>end
>cheers,
>--Mark

As a side note,
In some Inspector kind of tool of mine, I too filter out some methods:
       # Filter out most common methods that almost all objects implement
       objmethods = 123.public_methods()
       objmethods.concat 123.protected_methods()
       objmethods.concat 123.private_methods()
       # Filter out Enumerable's predicates, they block on IO objects
       tmp = Enumerable.instance_methods().reject { |m| m.include? "?" }
       objmethods.concat tmp
When user inspect an object, I display the object's instance variables and
the methods. For predicates, I directly display the predicate's value.
User can disable filtering (at his own risk regarding blocking predicates).

Yours,

Jean-Hugues