Code: extract `#max_lineno_width` from `#to_s`

"Code" means `Pry::Code`.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Code::LOC: tuple should be "reader"

There is no need to expose the "writer" method.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Code::LOC: add #== and use it in Code#==

And fix a typo in comments.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Create Pry::Code::EXTENSIONS

There is no need to create the hash of supported languages all the time
as the method gets called.

As always, fix some stylistics und stuff :-)

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Code#to_s: standardise method chain

Make it as in `Code#raw` (they both do similar things).

And fix typos, typos, typos.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Use `block` instead of `blk` across-the-board

Everywhere else in the code it's the very `block`.

Rename `Code#get_abs_path` to `#abs_path`.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Code#to_s: don't loop thrice

One loop is enough to complete the task.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Code: simplify `.from_file` class method

1. Use a temporary variable to hold code;
2. Instantiate `Pry::Code` only in one place;
3. Refactor reading from a file (a credit flies to John Mair).

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Fix calls to Tempfile.new (GH issue #792)

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.
Merge pull request #796 from L2G/gh-792

Fix calls to Tempfile.new (GH issue #792)
Remove legacy methods from helpers

From BaseHelpers:

  * #stub_proc
  * #create_command_stub

From CommandHelpers:

  * #retrieve_code_object_from_string
  * #file_and_line_from_binding
  * #make_header

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Extract out gem related code to Pry::Rubygem

And fix some typos, and prettify some lines.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Implement `Rubygem::install`

Use the code of `gem-install` command as a basis.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Pry::Command::Cat::FileFormatter: make format() private
Reimplemented play, save-file with Pry::Command::CodeCollector

Pry::Command::CodeCollector is a mixin that extracts out shared
functionality from play, save-file and gist. Gist is yet to be
reimplemented.
Pry::CodeObject: binding_lookup --> empty_lookup
implement whereami -n (exclude line numbers)
Pry::Command::CodeCollector: replace module inclusion with delegation

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.
Intermediate merge step
Immediate output from Guard

(So you know it's not Guard lag, but test suite start)