Skip to content

Commit

Permalink
Fix UserFileDefaultOptions#fetch implementation
Browse files Browse the repository at this point in the history
The usage of `||` fetch is incorrect,
as presence of `false` is the correct value.

This change uses `default` value,
only if the value is nowhere else defined.
  • Loading branch information
ayufan committed Apr 24, 2020
1 parent b0b17f6 commit ecf7578
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/puma/configuration.rb
Expand Up @@ -54,17 +54,18 @@ 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)
nil
end

def all_of(key)
Expand Down

0 comments on commit ecf7578

Please sign in to comment.