Mark Volkmann <r.mark.volkmann / gmail.com> wrote:
> On 9/22/05, Trans <transfire / gmail.com> wrote:
>> Class is an Object too, so
>> 
>>   MyClass.methods.sort.each {|m| puts m}
> 
> The method "methods" returns ALL the methods.
> I want just the class methods, those I can invoke without creating an
> object from the class.
> For example, querying the class Thread should give me "current", but
> not "alive?".

alive? is not returned from Thread.methods:

$ ruby -e 'p Thread.methods.grep(/alive/)'
[]

Robert@Babelfish2 ~
$ ruby -e 'Thread.methods.each {|m| puts m unless Thread.respond_to? m}'

Robert@Babelfish2 ~

Thread actually *does* respond to all these methods.

As Jason pointed out you're probably looking for Thread.singleton_methods.

Kind regards

    robert