0

Possible Duplicate:
Get list of a class' methods

Suppose I haven't any reference on hand, and I want to see all the methods in the built-in File class, is that simply available?

---------------------------EDIT---------------------------

answered in Get list of a class' instance methods

Community
  • 1
  • 1
demaxSH
  • 1,743
  • 2
  • 20
  • 27
  • 1
    This *exact same question* was already asked and answered many times here on StackOverflow, the last time was just *yesterday*, 18.5 hours before this one. How much can the Ruby language have changed between then and now, that this question needs to be asked *again*? Especially considering that the answer to *this* question is just plain wrong ... – Jörg W Mittag Jun 25 '11 at 08:38
  • @Jorg W Mittag: The answer that was originally accepted for that question was also just plain wrong. I think this question needs to be repeated until the fastest gun posts the correct answer! – Andrew Grimm Jun 25 '11 at 08:46
  • Besides the answer mentioned above, you can always drop to the command line and use `ri File`. `ri` also works for gems if you let `gem` build the docs. There's also `gem server` if you want to use a browser. – the Tin Man Jun 26 '11 at 04:08

1 Answers1

3

Sure, try:

File.methods

And if you have the awesome_print gem installed then it formats the list nicely and provides extra information.

Jits
  • 9,647
  • 1
  • 34
  • 27
  • See the question this duplicates to see why this is incorrect. – Andrew Grimm Jun 26 '11 at 01:41
  • It's not "incorrect"; I know it gives you only the class level methods on `File`, but since the questioner didn't specify exactly which set of methods they want I gave the most basic information that I thought they could extrapolate from. I definitely don't think it deserves vote downs! – Jits Jun 26 '11 at 08:50
  • "I know it gives you only the class level methods on File" - if you knew that, you should have said so in the answer. – Andrew Grimm Jun 26 '11 at 23:16