* --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 ?
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>
And implement play and save-file using the new delegator. 'gist' still needs
to be re-implemented using CodeCollector.
************
TODO:
**************
Couldn't write a test for `play --lines 4..5` with implied target.eval("__FILE__") parameter,
need to come up with a decent test.
Suffix of "*.rb" caused temp files to be named with "*.rb"
at the end, literally. Not all file systems like that, and
it's almost certainly not what was intended.
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)
* removed most historicla junk from lib/pry/test/helper.rb
* relocated recalcitrant junk to the local spec/helper.rb (this isn't exposed to 3rd parties)
`play 69` is a shortcut for `play --file #{_file_} --lines 69`. It plays
lines from the current file. Example (I omitted some useless
information):
pry(main)> show-source hello
def hello
binding.pry
true
puts "hi"
69
end
pry(main)> hello
1: def hello
=> 2: binding.pry
3: true
4: puts "hi"
5: 69
6: end
pry(main)> play 5
=> 69
pry(main)> play 3..4
hi
=> nil
pry(main)>
Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>