1
0
Fork 0
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:
Evan Phoenix 2016-02-19 17:05:59 -08:00
parent cf40a2dbc0
commit 80a47264ae

View file

@ -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