1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
Commit graph

6 commits

Author SHA1 Message Date
Ryan Fitzgerald
44466b8bda Fix warnings 2012-07-01 23:10:50 -07:00
John Mair
b3627c475e Ensure show-source/show-doc skip broken modules
This ensures that if the top-ranked module candidate is broken (i.e we can't extract its source)
that the module candidate with the next highest ranking is shown, and so on.

This commit also makes the speedy show-source more robust
2012-07-02 03:37:26 +12:00
John Mair
2a86378dd5 only look up geniuine class definitions, not code inside comments:P 2012-06-29 21:11:33 +12:00
John Mair
2ad9d0befc Initial implementation of fast show-source command.
This requires an updated method_source gem. This approach works by reading all code between the start of the class definition
and the method with the highest line number in one go. Since we know this chunk of code is valid we can avoid the expensive eval-based validity checks.
Once we have primed the expression buffer with this chunk of code we then start the expensive checks looking for a complete expression, but there shouldn't be
many lines of code left since we've already processed the last method in the class definition. Using this technique i was able to show-source the 2000 line definition of
ActiveRecord::Base in under a second.
2012-06-29 05:24:18 +12:00
John Mair
e23eba98b5 added tests for module candidate API 2012-06-23 20:14:10 +12:00
John Mair
0ee3c4af14 Extract out Pry::WrappedModule::Candidate from Pry::WrappedModule & document. 2012-06-23 13:23:22 +12:00