How to query locally generated docs

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the workflows category.

Last Updated: 2023-09-20

Often docs are out of date online (and too time-consuming to find/access). Therefore a must-have is a good local set of docs for dependencies.


In Ruby, enter yardoc

I can generate docs with:

yardoc # your own code
yard gems --debug # gems

Be careful the generated docs don't go to some folder in your project that is not in your gitignore. To avoid this, I like to generate them into the tmp directory.

# This only matters for generated HTML docs, which I probably don't want if yri the CLI tool below works
yardoc --out-dir tmp/yarddoc

List all classes (to check if gems were indexed)

yard -l

Generated, now on the command line I can use yri to query the docs.

NOTE This is NOT ri this is yri (or yard ri)

yri Aws::S3::Object#upload_file

Or visit a server on localhost:8808 after running yard server --gems