-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes pry#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).
- Loading branch information
Showing
31 changed files
with
571 additions
and
851 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class Pry | ||
class Config | ||
# Attributable provides the ability to create "attribute" | ||
# accessors. Attribute accessors create a standard "attr_writer" and a | ||
# customised "attr_reader". This reader is Proc-aware (lazy). | ||
# | ||
# @since ?.?.? | ||
# @api private | ||
module Attributable | ||
def attribute(attr_name) | ||
define_method(attr_name) do | ||
value = Config::Value.new(instance_variable_get("@#{attr_name}")) | ||
value.call | ||
end | ||
|
||
attr_writer(attr_name) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.