Pry 0.9.9 and Pry 0.9.9.1 (which contains a small documentation fix)
were released earlier today. This release comes with some major new
features (e.g. proper code highlighting for each line that you enter) as
well as the typical bug fixes.
## New Command: find-method
This command performs a recursive search for methods based on a regular
expression for the name or even the source code of the method. For
example, running `find-method -c String` would search for all methods
that contain a reference to "String" in their source code.
By far this is one of the nicest features in this release as it makes it
easy to find methods in a way similar to tools such as grep and ack, but
in a ruby-aware manner.
Thanks to swarley for contributing this feature
## Line Highlighting
While Pry was already capable of highlighting code blocks (such as code
extracted using show-method) it's now also capable of highlighting lines
of code after you've typed them and pressed the "Enter" key. An example
of this can be seen here:
## Improvements for show-source
The show-source command is now able to show the source code of not only
methods but also classes and modules. It also comes with an awesome new
feature that allows you to view all the monkeypatches of a class or
module. This feature relies on the "ruby18_source_location" gem on Ruby
This feature means that when you for example run `show-source -a String`
you'll get a list of all files that have code in them that patch the
Running `show-source String` would result in output similar to the
output shown here:
When running `show-source -a String` you'll instead get the following
## Improvements for show-doc
Similar to the show-source command the show-doc command is now capable
of displaying the documentation of classes, modules and methods (opposed
to just methods). This command also depends on "ruby18_source_location"
if you're using Ruby 1.8.
## Improvements for the alias_command method
The alias_command method (found in Pry.commands.alias_command) has been
made more powerful. For example, you can now do the following:
`Pry.commands.alias_command "lM" "ls -M"`.
## More intelligent whereami
The whereami command has been improved so that it automatically shows
the entire source code of the current method (given the current context
is inside a method).
Thanks to robgleeson for this improvement.
## New Command: raise-up
This command makes it possible to raise an exception that "bubbles out"
of Pry (thus ending the session). This makes it possible to raise
exceptions inside Pry and catch them using external applications.
## Generic Changes
* pry-coolline now works properly with Pry
* Fixed windows crashing bug when paging
* Lines ending with \ are incomplete (kudos to fowl)
* `edit-method -n` no longer blocks (thanks misfo)s
* Show instance methods of modules by default when using `ls`
* Documentation for methods, classes and modules defined in a Pry
session can be displayed using `show-doc`. Note that this requires at
least one method to be defined in the module or class when used on a
class or module.
* Autoload ruby18_source_location on mri18, when available
* Tab completion should work on first line now (historic bug fixed)
* :quiet => true option added to `Pry.start`, this option turns off
the whereami command.
* Another easter egg added
* Show unloaded constants in yellow when running `ls`
* Improved documentation for Pry.config options
* Improved auto indentation
* JRuby: heuristics used to clean up `ls` output (less internal methods