Pry 0.9.9 and Pry 0.9.9.1

1,266 views
Skip to first unread message

Yorick Peterse

unread,
Apr 18, 2012, 6:31:43 PM4/18/12
to pry...@googlegroups.com
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:
http://downloads.yorickpeterse.com/images/pry/line_highlight.png

## 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
1.8.

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
String class.

Running `show-source String` would result in output similar to the
output shown here:
http://downloads.yorickpeterse.com/images/pry/show_source.png

When running `show-source -a String` you'll instead get the following
output: http://downloads.yorickpeterse.com/images/pry/show_source_a.png

## 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
(https://github.com/pry/pry-coolline)
* 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
(https://github.com/conradirwin/ruby18_source_location)
* 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
polluting output)

Yorick

signature.asc
Reply all
Reply to author
Forward
0 new messages