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

4 commits

Author SHA1 Message Date
Kyrylo Silin
18c45d26c5 rubocop: enable the Style/FrozenStringLiteralComment cop
This will greatly ease Pry support on Ruby 3.0 (when it's out).
2019-05-08 00:13:17 +03:00
Kyrylo Silin
e6ac84e99c control_d_handler: don't mutate eval_string within the handler
This is a preparational step for #1824
(Enabling `# frozen_string_literal: true` in `~/.pryc` crashes most operations)

Alternative to https://github.com/pry/pry/pull/2030
(config: delete the `control_d_handler` option)

We had to jump a few hoops to change how the handler works. The problem is that
mutation is the default expected behaviour. Therefore, we had to change its
API. There's no need to pass `eval_string` because `pry_instance` already has it
as an attribute.

`config.control_d_handler` is a proxy proc, to preserve backwards compatibility
with users of old signature (one known user is Pry Byebug). The handler will
emit a warning if the old signature is used.
2019-05-04 23:17:59 +03:00
Kyrylo Silin
09ebd358e1 pry_instance: factor out command state to be global
This change is aimed to simplify #1843 (Rework the Pry config).

Current command state implementation gets in the way. We would like to simplify
the Config class. The current implementation penetrates Pry codebase everywhere,
and during my rework of the config I discovered that `watch` uses global command
state.

It means the state should survive `Pry.new` calls. With my (unpublished yet)
implementation, the `watch` command fails to do so. I realised that we can
refactor command state implementation to be global. It makes sense to me and
also helps with the Config refactoring.

With help of a dedicated class we can easily manage the command
state (resetting).
2019-04-29 20:06:51 +03:00
Kyrylo Silin
340f672f1d config: factor out control_d_handler to ControlDHandler 2019-04-15 03:18:17 +03:00