77module Net
88 class IMAP
99
10- # Net::IMAP::Config stores configuration options for Net::IMAP clients.
11- # The global configuration can be seen at either Net::IMAP.config or
12- # Net::IMAP:: Config.global, and the client-specific configuration can be
13- # seen at Net::IMAP#config.
10+ # Net::IMAP::Config <em>(available since +v0.4.13+)</em> stores
11+ # configuration options for Net::IMAP clients. The global configuration can
12+ # be seen at either Net::IMAP.config or Net::IMAP:: Config.global, and the
13+ # client-specific configuration can be seen at Net::IMAP#config.
1414 #
1515 # When creating a new client, all unhandled keyword arguments to
1616 # Net::IMAP.new are delegated to Config.new. Every client has its own
@@ -128,7 +128,7 @@ def self.default; @default end
128128 # The global config object. Also available from Net::IMAP.config.
129129 def self . global ; @global if defined? ( @global ) end
130130
131- # A hash of hard-coded configurations, indexed by version number.
131+ # A hash of hard-coded configurations, indexed by version number or name .
132132 def self . version_defaults ; @version_defaults end
133133 @version_defaults = { }
134134
@@ -172,9 +172,16 @@ def self.[](config)
172172 include AttrInheritance
173173 include AttrTypeCoercion
174174
175- # The debug mode (boolean)
175+ # The debug mode (boolean). The default value is +false+.
176176 #
177- # The default value is +false+.
177+ # When #debug is +true+:
178+ # * Data sent to and received from the server will be logged.
179+ # * ResponseParser will print warnings with extra detail for parse
180+ # errors. _This may include recoverable errors._
181+ # * ResponseParser makes extra assertions.
182+ #
183+ # *NOTE:* Versioned default configs inherit #debug from Config.global, and
184+ # #load_defaults will not override #debug.
178185 attr_accessor :debug , type : :boolean
179186
180187 # method: debug?
@@ -200,60 +207,84 @@ def self.[](config)
200207 # The default value is +5+ seconds.
201208 attr_accessor :idle_response_timeout , type : Integer
202209
203- # :markup: markdown
204- #
205210 # Whether to use the +SASL-IR+ extension when the server and \SASL
206- # mechanism both support it.
211+ # mechanism both support it. Can be overridden by the +sasl_ir+ keyword
212+ # parameter to Net::IMAP#authenticate.
213+ #
214+ # <em>(Support for +SASL-IR+ was added in +v0.4.0+.)</em>
207215 #
208- # See Net::IMAP#authenticate.
216+ # ==== Valid options
209217 #
210- # | Starting with version | The default value is |
211- # |-----------------------|------------------------------------------|
212- # | _original_ | +false+ <em>(extension unsupported)</em> |
213- # | v0.4 | +true+ <em>(support added)</em> |
218+ # [+false+ <em>(original behavior, before support was added)</em>]
219+ # Do not use +SASL-IR+, even when it is supported by the server and the
220+ # mechanism.
221+ #
222+ # [+true+ <em>(default since +v0.4+)</em>]
223+ # Use +SASL-IR+ when it is supported by the server and the mechanism.
214224 attr_accessor :sasl_ir , type : :boolean
215225
216- # :markup: markdown
217- #
218- # Controls the behavior of Net::IMAP#login when the `LOGINDISABLED`
226+ # Controls the behavior of Net::IMAP#login when the +LOGINDISABLED+
219227 # capability is present. When enforced, Net::IMAP will raise a
220- # LoginDisabledError when that capability is present. Valid values are:
228+ # LoginDisabledError when that capability is present.
221229 #
222- # [+false+]
230+ # <em>(Support for +LOGINDISABLED+ was added in +v0.5.0+.)</em>
231+ #
232+ # ==== Valid options
233+ #
234+ # [+false+ <em>(original behavior, before support was added)</em>]
223235 # Send the +LOGIN+ command without checking for +LOGINDISABLED+.
224236 #
225237 # [+:when_capabilities_cached+]
226238 # Enforce the requirement when Net::IMAP#capabilities_cached? is true,
227239 # but do not send a +CAPABILITY+ command to discover the capabilities.
228240 #
229- # [+true+]
241+ # [+true+ <em>(default since +v0.5+)</em> ]
230242 # Only send the +LOGIN+ command if the +LOGINDISABLED+ capability is not
231243 # present. When capabilities are unknown, Net::IMAP will automatically
232244 # send a +CAPABILITY+ command first before sending +LOGIN+.
233245 #
234- # | Starting with version | The default value is |
235- # |-------------------------|--------------------------------|
236- # | _original_ | `false` |
237- # | v0.5 | `true` |
238246 attr_accessor :enforce_logindisabled , type : [
239247 false , :when_capabilities_cached , true
240248 ]
241249
242- # :markup: markdown
250+ # Controls the behavior of Net::IMAP#responses when called without any
251+ # arguments (+type+ or +block+).
252+ #
253+ # ==== Valid options
254+ #
255+ # [+:silence_deprecation_warning+ <em>(original behavior)</em>]
256+ # Returns the mutable responses hash (without any warnings).
257+ # <em>This is not thread-safe.</em>
258+ #
259+ # [+:warn+ <em>(default since +v0.5+)</em>]
260+ # Prints a warning and returns the mutable responses hash.
261+ # <em>This is not thread-safe.</em>
243262 #
244- # Controls the behavior of Net::IMAP#responses when called without a
245- # block. Valid options are `:warn`, `:raise`, or
246- # `:silence_deprecation_warning` .
263+ # [+:frozen_dup+ <em>(planned default for +v0.6+)</em>]
264+ # Returns a frozen copy of the unhandled responses hash, with frozen
265+ # array values .
247266 #
248- # | Starting with version | The default value is |
249- # |-------------------------|--------------------------------|
250- # | v0.4.13 | +:silence_deprecation_warning+ |
251- # | v0.5 | +:warn+ |
252- # | _eventually_ | +:raise+ |
267+ # Note that calling IMAP#responses with a +type+ and without a block is
268+ # not configurable and always behaves like +:frozen_dup+.
269+ #
270+ # <em>(+:frozen_dup+ config option was added in +v0.4.17+)</em>
271+ #
272+ # [+:raise+]
273+ # Raise an ArgumentError with the deprecation warning.
274+ #
275+ # Note: #responses_without_args is an alias for #responses_without_block.
253276 attr_accessor :responses_without_block , type : [
254- :silence_deprecation_warning , :warn , :raise ,
277+ :silence_deprecation_warning , :warn , :frozen_dup , : raise,
255278 ]
256279
280+ alias responses_without_args responses_without_block # :nodoc:
281+ alias responses_without_args = responses_without_block = # :nodoc:
282+
283+ ##
284+ # :attr_accessor: responses_without_args
285+ #
286+ # Alias for responses_without_block
287+
257288 # Creates a new config object and initialize its attribute with +attrs+.
258289 #
259290 # If +parent+ is not given, the global config is used by default.
@@ -357,12 +388,11 @@ def defaults_hash
357388
358389 version_defaults [ 0.5 ] = Config [ :current ]
359390
360- version_defaults [ 0.6 ] = Config [ 0.5 ]
361- version_defaults [ :next ] = Config [ 0.6 ]
362-
363- version_defaults [ :future ] = Config [ 0.6 ] . dup . update (
364- responses_without_block : :raise ,
391+ version_defaults [ 0.6 ] = Config [ 0.5 ] . dup . update (
392+ responses_without_block : :frozen_dup ,
365393 ) . freeze
394+ version_defaults [ :next ] = Config [ 0.6 ]
395+ version_defaults [ :future ] = Config [ :next ]
366396
367397 version_defaults . freeze
368398 end
0 commit comments