A brief guide to Pry:
gem install pry pry-doc –no-ri –no-rdoc
pry-doc lets you browse core C source
Other flags: don’t bother installing the docs ‘cos it takes extra time
a. help help
Note: pry offers command line completion.
Show the documentation for a method or class. Tries instance methods first and
then methods by default.
e.g. if we create an object like this:
s = “pry”
then we can do:
From: string.c (C Method):
Number of lines: 30
Note, show-doc is smart. Can even read ri syntax.
which gives the same documentation.
shows each line of the implementation for String.
-l gives you line numbers.
d. Share your code
creates a gist and copies the URL to your clipboard.
More info here: http://pryrepl.org
The screencast there is great although it’s for a slightly older version of pry.
E.g. autocomplete on gist-method doesn’t work because this method doesn’t exist any more. It’s just called gist now.
This post is getting rather long so the rest will be in Part 2.