File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -288,16 +288,20 @@ def with(**attrs)
288288 def load_defaults ( version )
289289 [ Numeric , Symbol , String ] . any? { _1 === version } or
290290 raise ArgumentError , "expected number or symbol, got %p" % [ version ]
291- config = Config [ version ]
292- defaults = config . to_h . reject { |k , v | DEFAULT_TO_INHERIT . include? ( k ) }
293- update ( **defaults )
291+ update ( **Config [ version ] . defaults_hash )
294292 end
295293
296294 # :call-seq: to_h -> hash
297295 #
298296 # Returns all config attributes in a hash.
299297 def to_h ; data . members . to_h { [ _1 , send ( _1 ) ] } end
300298
299+ protected
300+
301+ def defaults_hash
302+ to_h . reject { |k , v | DEFAULT_TO_INHERIT . include? ( k ) }
303+ end
304+
301305 @default = new (
302306 debug : false ,
303307 open_timeout : 30 ,
@@ -308,9 +312,7 @@ def to_h; data.members.to_h { [_1, send(_1)] } end
308312
309313 @global = default . new
310314
311- version_defaults [ 0.4 ] = Config [
312- default . to_h . reject { |k , v | DEFAULT_TO_INHERIT . include? ( k ) }
313- ]
315+ version_defaults [ 0.4 ] = Config [ default . send ( :defaults_hash ) ]
314316
315317 version_defaults [ 0 ] = Config [ 0.4 ] . dup . update (
316318 sasl_ir : false ,
You can’t perform that action at this time.
0 commit comments