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

11 commits

Author SHA1 Message Date
Josh Cheek
6cc6e55f20 MemoizedValue memoizes nil results (#2053)
I moved the existing `subject` into the test because it didn't make sense for the second test I added.
2019-06-03 11:09:31 +03:00
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
e5556a2be8 Refactor Config
Fixes #1843 (Rework the Pry config)

There are a few breaking changes. They are mostly minor, so I decided not to
indroduce deprecations because it will considerable slow things down.

Key changes:

* `Pry.lazy` was replaced with `Pry::Configuration::LazyValue`

  The config accepts three values now `LazyValue`, `MemoizedValue` and simply
  `Value`. The main difference is that:
    - `Value` is any value, including procs (so that an option returns a raw
      proc)
    - `LazyValue` is a proc that is call on every invocation of an option
    - `MemoizedValue` is a value that is called only once (and then the option
      always returns the return value of the )

* `Pry.config.history` was a meta-option that held suboptions. However, the new
  config doesn't permit that (unless you know what you do)

  Instead, we introduce a few options. For example:
    - `Pry.config.history.histignore` becomes `Pry.config.history_ignorelist`
    - `Pry.config.history.file` becomes `Pry.config.history_file`
    - and so on

  This was done so we can simplify configuration merging. Inlining option makes
  configuration implementation simpler, without losing much. The rule is that
  you want to keep your options under your prefix (if you are a
  plugin). Therefore, say, `Pry.config.pry_rescue.*` should be
  `Pry.config.pry_rescue_*` if you need merging.

The rest should behave in a similar fashion (and I rely heavily on our test
suite to claim so).
2019-05-02 00:10:37 +03:00
r-obert
b5538b8501
Remove unnecessary classes / modules used by config (#1897)
* Remove` Pry::Config::Default`

* Remove `Pry::Config::Memoization`

* Remove confusing use of `instance_eval`

* Add `Pry::Config.defaults`
  Returns an instance of `Pry::Config`, initialized with Pry defaults.
  Replaces the previous role of `Pry::Config::Default`.
2018-12-01 08:51:52 +01:00
Kyrylo Silin
e61354693f Add .rspec and require 'helper' from there
Just discovered this nice feature of RSpec where it can load all files for
us. Works with `bundle exec rake` and `bundle exec rspec spec/file_spec.rb`,
which covers all use cases.
2018-11-18 14:04:44 +08:00
Kyrylo Silin
04d4f424e3 rubocop: fix offences regarding spaces
Fixes offences of the following cops:

* Layout/SpaceAroundEqualsInParameterDefault
* Layout/SpaceAroundOperators
* Layout/SpaceBeforeBlockBraces
* Layout/SpaceInsideBlockBraces
2018-11-04 17:34:24 +08:00
r-obert
72a17c5b24 last_default might not be a Pry::Config::Memoized 2017-06-23 17:42:04 +01:00
r-obert
505cccf691 rename Pry::Config::Lazy to Pry::Config::Memoization (ref #1503) 2017-06-23 06:18:19 +01:00
strcmp
c584d173a1 fix 'at least one lazy method has to be called before #lazy_keys could ..' 2015-12-31 16:02:34 -08:00
strcmp
6531140f06 add tests 2015-12-31 15:46:31 -08:00
strcmp
398a62bf79 add lazy_spec.rb 2015-12-31 03:59:53 +00:00