Einar Magnús Boson
12/17/2008 6:04:00 AM
f.methods
f.methods(false) to skip the inherited ones.
usually this is helpful:
puts f.methods(false).sort
On 17.12.2008, at 05:36 , Joshua Ball wrote:
> I am curious if there is a programatic way to list all methods of a
> class.
> (Yes, I know about "ri", I am just curious here)
>
> For instance, I am trying to figure out what I could do with the
> File f in:
> open(ARGV[0], 'rb') { |f|
> puts f.stat.mtime
> puts f.class
> }
>
> Now, f.class returns: File
>
> Is there anything like:
> f.functions.each { |p| puts p }
>
> Thanks
einarmagnus