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)
288
288
def load_defaults ( version )
289
289
[ Numeric , Symbol , String ] . any? { _1 === version } or
290
290
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 )
294
292
end
295
293
296
294
# :call-seq: to_h -> hash
297
295
#
298
296
# Returns all config attributes in a hash.
299
297
def to_h ; data . members . to_h { [ _1 , send ( _1 ) ] } end
300
298
299
+ protected
300
+
301
+ def defaults_hash
302
+ to_h . reject { |k , v | DEFAULT_TO_INHERIT . include? ( k ) }
303
+ end
304
+
301
305
@default = new (
302
306
debug : false ,
303
307
open_timeout : 30 ,
@@ -308,9 +312,7 @@ def to_h; data.members.to_h { [_1, send(_1)] } end
308
312
309
313
@global = default . new
310
314
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 ) ]
314
316
315
317
version_defaults [ 0 ] = Config [ 0.4 ] . dup . update (
316
318
sasl_ir : false ,
You can’t perform that action at this time.
0 commit comments