There was a bug where if 'edit --ex' was invoked in a patched method context
it would instead to the equivalent of 'edit --method' (patching the current method
rather than the exception)
* --method doesn't accept any parameters, it only edits the 'current' method associated
with the binding. It's equivalent to 'edit-method' (with no args).
* This option is necessary as 'edit' by itself edits the last expression.
* Note that --method doesn't just edit the current method, if no method exists (i.e binding.pry was not put
inside a method context) then it edits the current OBJECT instead.
TODO:
* explicitly restrict --method to *just* methods and not allow it to fall back to objects?
* allow --method to take a parameter that must be a method object? e.g --method Pry#repl works
but --method Pry would fail ?
* put all file and line location logic into FileAndLineLocator module
* pass explicit parameters to ExceptionPatcher and MethodPatcher (rather than just 'self')
Wrap command descriptions to 80 characters. Convert some string options
to symbols (where possible). Align options in code. Remove dots in the
end of switch descriptions.
Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
* Remove ContextLocator, inlining the class in edit.rb instead.
* Pass explicit parameters into MethodPatcher and ExceptionPatcher, rather than passing 'self'
and using def_delegators
Hopefully this won't upset codeclimate too much!
edit now accepts the -p (runtime patch) switch, and can patch methods.
Coming soon: patching of classes and commands.
edit-method command has been left in codebase until 100% sure 'edit' is a full replacement.
John "banister" Mair describes the following key features of commands
as classes:
1. It enables people to extend them by either subclassing or
monkeypatching.
2. It enables them to provide their own API, so that for example, the
Pry::Command::Edit class could have class methods for people to
configure it.
Please, note that I didn't touch easter eggs commands. I also prettified
some strings (your source code reading experience should vastly improve!).
Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Fix issue #716 (edit --ex -p)
Nothing interesting to describe :S
Implement the feature and add a test for it. Also, remove a couple of
extra characters from some lines (namely, quotation marks and nils).
Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>