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

Fix UserFileDefaultOptions#fetch to properly consume default value #2233

Merged
merged 1 commit into from Apr 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions History.md
Expand Up @@ -38,6 +38,7 @@
* Fixed a few minor concurrency bugs in ThreadPool that may have affected non-GVL Rubies (#2220)
* Fix `out_of_band` hook never executed if the number of worker threads is > 1 (#2177)
* Fix ThreadPool#shutdown timeout accuracy (#2221)
* Fix `UserFileDefaultOptions#fetch` to properly use `default` (#2233)

* Refactor
* Remove unused loader argument from Plugin initializer (#2095)
Expand Down
10 changes: 6 additions & 4 deletions lib/puma/configuration.rb
Expand Up @@ -54,17 +54,19 @@ def initialize(user_options, default_options)
attr_reader :user_options, :file_options, :default_options

def [](key)
return user_options[key] if user_options.key?(key)
return file_options[key] if file_options.key?(key)
return default_options[key] if default_options.key?(key)
fetch(key)
end

def []=(key, value)
user_options[key] = value
end

def fetch(key, default_value = nil)
self[key] || default_value
return user_options[key] if user_options.key?(key)
return file_options[key] if file_options.key?(key)
return default_options[key] if default_options.key?(key)

default_value
end

def all_of(key)
Expand Down