Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Config #2024

Merged
merged 1 commit into from May 1, 2019
Merged

Refactor Config #2024

merged 1 commit into from May 1, 2019

Conversation

kyrylo
Copy link
Member

@kyrylo kyrylo commented May 1, 2019

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).

@kyrylo kyrylo force-pushed the configuration-refactoring branch 2 times, most recently from 084d33f to 8d869ac Compare May 1, 2019 21:06
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).
@kyrylo kyrylo force-pushed the configuration-refactoring branch from 8d869ac to e5556a2 Compare May 1, 2019 21:10
@kyrylo kyrylo merged commit e2c4aa6 into master May 1, 2019
@kyrylo kyrylo deleted the configuration-refactoring branch May 1, 2019 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rework the Pry config
1 participant