mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Clamp dynamic defaults properly
This commit is contained in:
parent
cf40a2dbc0
commit
80a47264ae
1 changed files with 10 additions and 1 deletions
|
@ -16,7 +16,7 @@ module Puma
|
|||
def initialize(default={})
|
||||
@cur = {}
|
||||
@set = [@cur]
|
||||
@defaults = default
|
||||
@defaults = default.dup
|
||||
end
|
||||
|
||||
def initialize_copy(other)
|
||||
|
@ -105,6 +105,14 @@ module Puma
|
|||
indent = " #{indent}"
|
||||
end
|
||||
end
|
||||
|
||||
def force_defaults
|
||||
@defaults.each do |k,v|
|
||||
if v.respond_to? :call
|
||||
@defaults[k] = v.call
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Configuration
|
||||
|
@ -198,6 +206,7 @@ module Puma
|
|||
# is loaded to flesh out any defaults
|
||||
def clamp
|
||||
@options.shift
|
||||
@options.force_defaults
|
||||
end
|
||||
|
||||
# Injects the Configuration object into the env
|
||||
|
|
Loading…
Add table
Reference in a new issue