7
7
module Net
8
8
class IMAP
9
9
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.
14
14
#
15
15
# When creating a new client, all unhandled keyword arguments to
16
16
# Net::IMAP.new are delegated to Config.new. Every client has its own
@@ -128,7 +128,7 @@ def self.default; @default end
128
128
# The global config object. Also available from Net::IMAP.config.
129
129
def self . global ; @global if defined? ( @global ) end
130
130
131
- # A hash of hard-coded configurations, indexed by version number.
131
+ # A hash of hard-coded configurations, indexed by version number or name .
132
132
def self . version_defaults ; @version_defaults end
133
133
@version_defaults = { }
134
134
@@ -172,9 +172,16 @@ def self.[](config)
172
172
include AttrInheritance
173
173
include AttrTypeCoercion
174
174
175
- # The debug mode (boolean)
175
+ # The debug mode (boolean). The default value is +false+.
176
176
#
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.
178
185
attr_accessor :debug , type : :boolean
179
186
180
187
# method: debug?
@@ -200,60 +207,84 @@ def self.[](config)
200
207
# The default value is +5+ seconds.
201
208
attr_accessor :idle_response_timeout , type : Integer
202
209
203
- # :markup: markdown
204
- #
205
210
# 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>
207
215
#
208
- # See Net::IMAP#authenticate.
216
+ # ==== Valid options
209
217
#
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.
214
224
attr_accessor :sasl_ir , type : :boolean
215
225
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+
219
227
# 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.
221
229
#
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>]
223
235
# Send the +LOGIN+ command without checking for +LOGINDISABLED+.
224
236
#
225
237
# [+:when_capabilities_cached+]
226
238
# Enforce the requirement when Net::IMAP#capabilities_cached? is true,
227
239
# but do not send a +CAPABILITY+ command to discover the capabilities.
228
240
#
229
- # [+true+]
241
+ # [+true+ <em>(default since +v0.5+)</em> ]
230
242
# Only send the +LOGIN+ command if the +LOGINDISABLED+ capability is not
231
243
# present. When capabilities are unknown, Net::IMAP will automatically
232
244
# send a +CAPABILITY+ command first before sending +LOGIN+.
233
245
#
234
- # | Starting with version | The default value is |
235
- # |-------------------------|--------------------------------|
236
- # | _original_ | `false` |
237
- # | v0.5 | `true` |
238
246
attr_accessor :enforce_logindisabled , type : [
239
247
false , :when_capabilities_cached , true
240
248
]
241
249
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>
243
262
#
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 .
247
266
#
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.
253
276
attr_accessor :responses_without_block , type : [
254
- :silence_deprecation_warning , :warn , :raise ,
277
+ :silence_deprecation_warning , :warn , :frozen_dup , : raise,
255
278
]
256
279
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
+
257
288
# Creates a new config object and initialize its attribute with +attrs+.
258
289
#
259
290
# If +parent+ is not given, the global config is used by default.
@@ -357,12 +388,11 @@ def defaults_hash
357
388
358
389
version_defaults [ 0.5 ] = Config [ :current ]
359
390
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 ,
365
393
) . freeze
394
+ version_defaults [ :next ] = Config [ 0.6 ]
395
+ version_defaults [ :future ] = Config [ :next ]
366
396
367
397
version_defaults . freeze
368
398
end
0 commit comments