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

17 commits

Author SHA1 Message Date
Conrad Irwin
71b364e97c Move all hacking of rbx paths into Pry::Code 2013-05-10 00:49:36 -07:00
John Mair
a270fbc1ec WrappedModule::Candidate: exposed number_of_candidates as public method 2013-03-12 21:01:28 +02:00
Conrad Irwin
d6ef67cfa7 Remove warnings [Fixes #869] 2013-03-02 16:01:55 -08:00
John Mair
7260c2eb58 Delegate more methods from Candidate back to WrappedModule 2013-02-07 15:57:41 +01:00
Conrad Irwin
1c2d77e7fc Fix documentation rendering edge-cases [Fixes #795]
Also added some notably absent tests
2013-02-01 01:30:07 -08:00
John Mair
6e3800fa74 Pry::WrappedModule#source no longer raises if it can't find source.
This is not an exceptional situation so an exception should not be used. nil is now returned instead.
2013-01-29 15:25:05 +01:00
John Mair
e41a9e1588 Pry::WrappedModule::Candidate: break up some large methods 2013-01-03 01:47:22 +01:00
John Mair
92c345aa12 module_candidate.rb improved class lookup regex
Bug prevented lookup of Deeply::Nested::Class::Definitions.

Also properly differentiate when looking up docs/source for *commands* and for the class that represents the command, i.e:
show-doc show-source #=> displays show-source --help
show-doc Pry::Command::ShowSource #=> comments above class definition (as with any other class)
2012-12-27 23:02:53 +01:00
John Mair
407b20470a improve show-source/show-doc via Pry::CodeObject::Helpers mixin
Pry::CodeObject::Helpers mixin provides the following methods:
command?
module_with_yard_docs?
real_method_object?
c_method?

which are then mixed into the code objects: Pry::Command, Pry::Method, Pry::WrappedModule, Pry::WrappedModule::Candidate
2012-12-25 13:50:42 +01:00
John Mair
f1c29b2ed0 Pry::WrappedModule::Candidate#doc no longer syntax highlights documentation
Also now including DocumentationHelpers so we can access the strip_* methods, useful for removing leading spaces and hashes from
raw comments.
2012-12-21 16:36:17 +01:00
John Mair
3f7448ed4c Pry::WrappedModule::Candidate, added source_file and source_line
For consistency with Pry::WrappedModule and Pry::Method, etc
2012-12-20 20:13:19 +01:00
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