@@ -212,15 +212,15 @@ def self.[](config)
212212 # See Net::IMAP.new and Net::IMAP#starttls.
213213 #
214214 # The default value is +30+ seconds.
215- attr_accessor :open_timeout , type : Integer
215+ attr_accessor :open_timeout , type : Integer , default : 30
216216
217217 # Seconds to wait until an IDLE response is received, after
218218 # the client asks to leave the IDLE state.
219219 #
220220 # See Net::IMAP#idle and Net::IMAP#idle_done.
221221 #
222222 # The default value is +5+ seconds.
223- attr_accessor :idle_response_timeout , type : Integer
223+ attr_accessor :idle_response_timeout , type : Integer , default : 5
224224
225225 # Whether to use the +SASL-IR+ extension when the server and \SASL
226226 # mechanism both support it. Can be overridden by the +sasl_ir+ keyword
@@ -236,7 +236,10 @@ def self.[](config)
236236 #
237237 # [+true+ <em>(default since +v0.4+)</em>]
238238 # Use +SASL-IR+ when it is supported by the server and the mechanism.
239- attr_accessor :sasl_ir , type : :boolean
239+ attr_accessor :sasl_ir , type : :boolean , defaults : {
240+ 0.0 r => false ,
241+ 0.4 r => true ,
242+ }
240243
241244 # Controls the behavior of Net::IMAP#login when the +LOGINDISABLED+
242245 # capability is present. When enforced, Net::IMAP will raise a
@@ -260,7 +263,10 @@ def self.[](config)
260263 #
261264 attr_accessor :enforce_logindisabled , type : Enum [
262265 false , :when_capabilities_cached , true
263- ]
266+ ] , defaults : {
267+ 0.0 r => false ,
268+ 0.5 r => true ,
269+ }
264270
265271 # The maximum allowed server response size. When +nil+, there is no limit
266272 # on response size.
@@ -294,7 +300,10 @@ def self.[](config)
294300 #
295301 # * original: +nil+ <em>(no limit)</em>
296302 # * +0.5+: 512 MiB
297- attr_accessor :max_response_size , type : Integer?
303+ attr_accessor :max_response_size , type : Integer? , defaults : {
304+ 0.0 r => nil ,
305+ 0.5 r => 512 << 20 , # 512 MiB
306+ }
298307
299308 # Controls the behavior of Net::IMAP#responses when called without any
300309 # arguments (+type+ or +block+).
@@ -324,7 +333,11 @@ def self.[](config)
324333 # Note: #responses_without_args is an alias for #responses_without_block.
325334 attr_accessor :responses_without_block , type : Enum [
326335 :silence_deprecation_warning , :warn , :frozen_dup , :raise ,
327- ]
336+ ] , defaults : {
337+ 0.0 r => :silence_deprecation_warning ,
338+ 0.5 r => :warn ,
339+ 0.6 r => :frozen_dup ,
340+ }
328341
329342 alias responses_without_args responses_without_block # :nodoc:
330343 alias responses_without_args = responses_without_block = # :nodoc:
@@ -369,7 +382,11 @@ def self.[](config)
369382 # ResponseParser _only_ uses AppendUIDData and CopyUIDData.
370383 attr_accessor :parser_use_deprecated_uidplus_data , type : Enum [
371384 true , :up_to_max_size , false
372- ]
385+ ] , defaults : {
386+ 0.0 r => true ,
387+ 0.5 r => :up_to_max_size ,
388+ 0.6 r => false ,
389+ }
373390
374391 # The maximum +uid-set+ size that ResponseParser will parse into
375392 # deprecated UIDPlusData. This limit only applies when
@@ -393,7 +410,13 @@ def self.[](config)
393410 # * +0.5+: <tt>100</tt>
394411 # * +0.6+: <tt>0</tt>
395412 #
396- attr_accessor :parser_max_deprecated_uidplus_data_size , type : Integer
413+ attr_accessor :parser_max_deprecated_uidplus_data_size , type : Integer ,
414+ defaults : {
415+ 0.0 r => 10_000 ,
416+ 0.4 r => 1_000 ,
417+ 0.5 r => 100 ,
418+ 0.6 r => 0 ,
419+ }
397420
398421 # Creates a new config object and initialize its attribute with +attrs+.
399422 #
@@ -482,34 +505,6 @@ def defaults_hash
482505
483506 @global = default . new
484507
485- version_defaults [ 0 r] = {
486- sasl_ir : false ,
487- responses_without_block : :silence_deprecation_warning ,
488- enforce_logindisabled : false ,
489- max_response_size : nil ,
490- parser_use_deprecated_uidplus_data : true ,
491- parser_max_deprecated_uidplus_data_size : 10_000 ,
492- }
493-
494- version_defaults [ 0.4 r] = {
495- sasl_ir : true ,
496- parser_max_deprecated_uidplus_data_size : 1000 ,
497- }
498-
499- version_defaults [ 0.5 r] = {
500- enforce_logindisabled : true ,
501- max_response_size : 512 << 20 , # 512 MiB
502- responses_without_block : :warn ,
503- parser_use_deprecated_uidplus_data : :up_to_max_size ,
504- parser_max_deprecated_uidplus_data_size : 100 ,
505- }
506-
507- version_defaults [ 0.6 r] = {
508- responses_without_block : :frozen_dup ,
509- parser_use_deprecated_uidplus_data : false ,
510- parser_max_deprecated_uidplus_data_size : 0 ,
511- }
512-
513508 AttrVersionDefaults . compile_version_defaults!
514509
515510 if ( $VERBOSE || $DEBUG) && self [ :current ] . to_h != self [ :default ] . to_h
0 commit comments