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

28 commits

Author SHA1 Message Date
Trey Lawrence
9b5b26fde2 Change wrapped method to public 2012-07-22 22:26:19 -04:00
Conrad Irwin
4bcabfad5d Highlight code in comments as ruby regardless
Before this change, ? Array.try_convert would highlight the code
snippets as C, but because it's actually a ruby method all the code in
the comment is ruby.
2012-07-09 15:20:29 -07:00
Conrad Irwin
4902c7215a Remove non-determinancy caused by rbx oddity 2012-07-05 21:17:25 -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
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
Conrad Irwin
4714d1835c No select! on 1.8.7 2012-06-28 02:29:05 -07:00
Conrad Irwin
61c7227675 Don't call .alias? in WrappedModule#source_location
Unfortunately, alias? requires loading the entire source code for each method,
so this can get pretty slow for modules that include hundreds of methods.
2012-06-28 02:10:21 -07:00
Ryan Fitzgerald
e14ee9a6f4 Fix various mangled documentation 2012-06-26 22:30:00 -07:00
John Mair
37d9e5cbb9 more tightly spec WrappedModule, and ensure WM#source_location doesn't raise 2012-06-25 04:04:43 +12:00
Conrad Irwin
910afece04 Use actual filename for gist 2012-06-23 13:13:32 -07: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
Conrad Irwin
6733439b29 Rely on the next version of method_source's CodeHelpers
Cleans up a lot of duplication of hairy code.
2012-06-03 18:44:19 -07:00
John Mair
b313a03c8f allow (class|instance)_eval based monkeypatch detection for show-source -a 2012-06-04 05:00:11 +12:00
Ryan Fitzgerald
493c085888 Fix all warnings on startup in 1.9.3 2012-05-28 16:37:32 -07:00
John Mair
5993c45215 DRYed up show-doc/show-source code
* also made Pry::WrappedModule.from_str more robust
2012-04-18 12:12:19 +12:00
John Mair
08dd259161 Pry::WrappedModule.from_str respects binding
* module are now looked up with respect to the optional binding parameter to from_str
* also improved some docs
2012-04-18 11:38:31 +12:00
John Mair
e6b280d488 show-source -v => show-source -a
* switch to show all monkeypatches is now -a (for all)
* improved some method names (top_method_candidates => method_candidates in wrapped_module.rb)
* improved in-session documentation for show-source and show-doc
2012-04-18 00:25:33 +12:00
John Mair
77387b3e5c module constants should be looked up at top-level by default 2012-04-17 22:50:39 +12:00
John Mair
b5d044eeb2 added -v switch show-source and show-doc
* applies to modules/classes, displays the full list of candidate module definitions or documentation (in case of show-doc)
* TODO: a fucktonne of tests
2012-04-17 17:14:35 +12:00
John Mair
d8d80419ee show-doc for core classes now shows file name, closes #536 2012-04-16 16:24:48 +12:00
John Mair
df5931c681 added Pry::WrappedModule.from_str 2012-04-15 17:33:58 +12:00
Reginald Tan
d7894a27d7 Correct Pry::WrappedModule#respond_to? definition, fixes #530 2012-04-14 16:25:46 -04:00
John Mair
eb3e650388 moved doc helpers into DocumentationHelpers module
* also defined a WrappedModule#doc
* TODO: define a module_object (analogous to method_object) for method_options(), to further DRY up show-doc and show-source
2012-04-13 02:17:47 +12:00
John Mair
87633cd4d9 advanced module methods now in Pry::WrappedModule
* WrappedModule#source_location, WrappedModule#source, analogous to Pry::Method
2012-04-13 00:30:26 +12:00
Conrad Irwin
30e1e0941e Use Helpers::BaseHelpers.<foo>? MOAR 2011-12-27 23:16:53 +00:00
Conrad Irwin
778c50316f Show something for anonymous classes. [Fixes #366] 2011-12-19 00:58:27 -08:00
Conrad Irwin
22ca4a8e13 Add a wrapped module abstraction 2011-12-02 00:31:46 -08:00