Skip to content

Commit f676fb3

Browse files
committed
📚 Improve Config rdoc
I tried using markdown for the tables, but it screwed up other formatting. This format (with definition lists) is more "standard" for rdoc.
1 parent 8c25109 commit f676fb3

File tree

1 file changed

+47
-34
lines changed

1 file changed

+47
-34
lines changed

lib/net/imap/config.rb

Lines changed: 47 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
module 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,56 +207,62 @@ 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+
# [+:raise+ <em>(planned future default)</em>]
264+
# Raise an ArgumentError with the deprecation warning.
247265
#
248-
# | Starting with version | The default value is |
249-
# |-------------------------|--------------------------------|
250-
# | v0.4.13 | +:silence_deprecation_warning+ |
251-
# | v0.5 | +:warn+ |
252-
# | _eventually_ | +:raise+ |
253266
attr_accessor :responses_without_block, type: [
254267
:silence_deprecation_warning, :warn, :raise,
255268
]

0 commit comments

Comments
 (0)