Skip to content

Commit 9b3317b

Browse files
authored
📚 Doc improvements for open_timeout, etc (#424)
* 📚 Update rdoc for methods delegated to Config * 📚 Document that open_timeout is used for TLS too * 📚 Add a few missing words to docs
2 parents 1a600a0 + 4c61347 commit 9b3317b

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

lib/net/imap.rb

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -807,9 +807,11 @@ class IMAP < Protocol
807807
def self.config; Config.global end
808808

809809
# Returns the global debug mode.
810+
# Delegates to {Net::IMAP.config.debug}[rdoc-ref:Config#debug].
810811
def self.debug; config.debug end
811812

812813
# Sets the global debug mode.
814+
# Delegates to {Net::IMAP.config.debug=}[rdoc-ref:Config#debug=].
813815
def self.debug=(val)
814816
config.debug = val
815817
end
@@ -830,7 +832,7 @@ class << self
830832
alias default_ssl_port default_tls_port
831833
end
832834

833-
# Returns the initial greeting the server, an UntaggedResponse.
835+
# Returns the initial greeting sent by the server, an UntaggedResponse.
834836
attr_reader :greeting
835837

836838
# The client configuration. See Net::IMAP::Config.
@@ -839,13 +841,20 @@ class << self
839841
# Net::IMAP.config.
840842
attr_reader :config
841843

842-
# Seconds to wait until a connection is opened.
843-
# If the IMAP object cannot open a connection within this time,
844-
# it raises a Net::OpenTimeout exception. The default value is 30 seconds.
845-
def open_timeout; config.open_timeout end
844+
##
845+
# :attr_reader: open_timeout
846+
# Seconds to wait until a connection is opened. Also used by #starttls.
847+
# Delegates to {config.open_timeout}[rdoc-ref:Config#open_timeout].
846848

849+
##
850+
# :attr_reader: idle_response_timeout
847851
# Seconds to wait until an IDLE response is received.
848-
def idle_response_timeout; config.idle_response_timeout end
852+
# Delegates to {config.idle_response_timeout}[rdoc-ref:Config#idle_response_timeout].
853+
854+
# :stopdoc:
855+
def open_timeout; config.open_timeout end
856+
def idle_response_timeout; config.idle_response_timeout end
857+
# :startdoc:
849858

850859
# The hostname this client connected to
851860
attr_reader :host
@@ -1332,6 +1341,10 @@ def logout!
13321341
# both successful. Any error indicates that the connection has not been
13331342
# secured.
13341343
#
1344+
# After the server agrees to start a TLS connection, this method waits up to
1345+
# {config.open_timeout}[rdoc-ref:Config#open_timeout] before raising
1346+
# +Net::OpenTimeout+.
1347+
#
13351348
# *Note:*
13361349
# >>>
13371350
# Any #response_handlers added before STARTTLS should be aware that the

lib/net/imap/config.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,13 @@ def self.[](config)
193193

194194
# Seconds to wait until a connection is opened.
195195
#
196+
# Applied separately for establishing TCP connection and starting a TLS
197+
# connection.
198+
#
196199
# If the IMAP object cannot open a connection within this time,
197200
# it raises a Net::OpenTimeout exception.
198201
#
199-
# See Net::IMAP.new.
202+
# See Net::IMAP.new and Net::IMAP#starttls.
200203
#
201204
# The default value is +30+ seconds.
202205
attr_accessor :open_timeout, type: Integer

0 commit comments

Comments
 (0)