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

🔧 Add Config#load_defaults #301

Merged
merged 2 commits into from
Jun 22, 2024
Merged

Conversation

nevans
Copy link
Collaborator

@nevans nevans commented Jun 21, 2024


This is inspired by Rails::Application::Configuration#load_defaults in rails.

Config#load_defaults resets the current config to behave like the versioned default configuration for the requested version. (See #302.)

For example, #load_defaults can be used to globally behave more like a specific version of net-imap:

client = Net::IMAP.new(hostname)
client.config.sasl_ir              # => true
Net::IMAP.config.load_defaults 0.3
client.config.sasl_ir              # => false

@nevans nevans force-pushed the config-load_defaults branch 2 times, most recently from e2b341a to cad8200 Compare June 22, 2024 01:25
@nevans nevans linked an issue Jun 22, 2024 that may be closed by this pull request
@nevans nevans force-pushed the config-load_defaults branch 3 times, most recently from 200b51d to 6a4fd2c Compare June 22, 2024 14:55
This is inspired by Rails::Application::Configuration#load_defaults in
rails.

`#load_defaults` resets the current config to behave like the versioned
default configuration for that version.  `#parent` will not be changed.

Some config attributes default to inheriting from their `#parent` (which
is usually Config.global) and are left unchanged, for example: `#debug`.
@nevans nevans merged commit 958e872 into ruby:master Jun 22, 2024
13 checks passed
@nevans nevans deleted the config-load_defaults branch June 22, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add Net::IMAP::Config class for global and client-scoped config
1 participant