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

16 commits

Author SHA1 Message Date
yui-knk
c0da62be91 Refactor Pry::Method.from_str , because of comment on method_or_class_lookup in lib/pry/code_object.rb . 2014-01-03 11:50:19 +09:00
Danielle Sucher
858f7d3b88 Show method docs for Foo() and class docs for Foo 2013-09-06 14:58:12 -07:00
John Mair
c95c25e4d8 Allow show-source --super
Fixing this just required refactoring Pry::CodeObject#empty_lookup
so it respected the 'super_level' parameter
2013-05-18 02:23:01 +02:00
Kyrylo Silin
7a6a6164fe CodeObject: special case super keyword
Fix issue #917 (`$ super` should work (so should `$ -s`))

This is applies to both `show-source` and `show-doc`.
2013-05-04 00:33:38 +03:00
Kyrylo Silin
2d4dc78899 Show{Source,Doc}: refactor assuming definitions from the context
I hope you're pleased now, @banister!
2013-05-03 23:42:19 +03:00
John Mair
7ae55b3a8a Pry::CodeObject: remove unnecessary 'target' parameter
Since we can access 'target' via _pry_.current_context

* We also update a few files (code_collector/show_info) that need to be updated for this change
2013-01-11 20:47:46 +01:00
John Mair
0608c0effa Pry::CodeObject: binding_lookup --> empty_lookup 2013-01-09 01:42:08 +01:00
John Mair
470c938210 Pry::CodeObject, Pry::WrappedModule: introduce safe_to_evaluate? method
Unsure where to put safe_to_evaluate? method, so it's currently duplicated in
both the mentioned modules. If we can simply switch to a defined?(str) != "method" test
then we could put the method on Pry::Method.looks_like_a_method?(str, binding) and call it from both locations, avoiding duplication.

https://www.evernote.com/shard/s130/sh/4e839419-387e-43ab-81d5-06f87aa2cbac/2c640432e3ecccb2035c69c347f63af1
2013-01-06 00:16:44 +01:00
John Mair
f1654d8603 Allow 'edit self' and 'reload-code self'
This didn't work due to a quirk in Pry::CodeObject.lookup() which purposely ignores 'expressions'
as they can be methods, which are dangerous to lookup. We now make an exception when the expression is 'self'

This code needs to be refactored as we have ridiculosu method names like  `def variable_or_constant_or_self?`
and we have methods like this in a couple of places. Refactor pls.
2013-01-05 21:17:07 +01:00
John Mair
4d384737a7 bunch of random refactorings to different commands 2013-01-02 02:06:51 +01:00
John Mair
c1ae63446f define .source, .doc, etc on Pry::ClassCommand
This is so that Pry::CodeObject can return Pry::ClassCommand objects directly, this is impt
as we want slightly different behaviour than just Pry::WrappedModule(command_class), notably .doc should return
command help rather than comments above the command's class definition.
2012-12-27 23:02:52 +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
2f0c4c28a6 Pry::CodeObject, allow lookups for methods of the form: local#method
the '#' used to be interpreted as a comment and so only 'local' and not the associated method was looked up.
Fixed this by letting strings of the form /\S#\S/ pass through to Pry::Method lookup
2012-12-22 22:59:03 +01:00
John Mair
e23ec5ed33 fixed up code_object.rb to retrieve commands by listing name 2012-12-20 18:05:42 +01:00
John Mair
405aacf76d added ability to extract an implicit object from binding when no string is given 2012-12-20 18:05:42 +01:00
John Mair
bbd4df87d4 started code_object stuff 2012-12-20 18:05:42 +01:00