What is the fastest way to get documentation for Ruby?

Say I'm writing ruby ​​code, and I want to use the standard Date type to get the current date. Instead of using a search engine, is there a faster way to find documentation for this class? I know that I can get methods for Date by typing Date.methods, but as far as I know, this does not give details about the types of arguments or the return value.

Responses to specific answers are welcome. My selection editor is Emacs.

+3
source share
4 answers

Ruby core docs bookmark

Use the web browser text search command.

, , , , ri, - , , .

, ri, HTML . , 2 ri

+4

"ri"

ri Date

. (, ri String) , :

ri Date#yourMethod
+3

Ruby Ruby-doc - , , core . javadoc, . RDoc.

+1

For those of you who want documents from vanilla IRB

  • Follow these instructions to set up the basic documentation for RI. Starting with the steps

    $ cd ~/.rvm/src
    $ rvm docs generate-ri
    
  • Now you can view documents for a specific method on the command line using the command ri. To call it from the IRB, use the help command:

    $ irb
    irb(main):001:0> help 'String#chomp'
    
0
source

Source: https://habr.com/ru/post/1697632/


All Articles