Skip to content

Commit d4e15e0

Browse files
committed
📚 Document fields for ResponseText, ResponseCode
* Move struct field docs from the class to methods inside the class. * Remove ABNF comments. * Add type information to the call-seq or the method rdoc text. * Link to the data type(s) that are returned, when possible.
1 parent f167e3c commit d4e15e0

File tree

1 file changed

+34
-24
lines changed

1 file changed

+34
-24
lines changed

lib/net/imap/response_data.rb

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -101,38 +101,48 @@ class TaggedResponse < Struct.new(:tag, :name, :data, :raw_data)
101101
end
102102

103103
# Net::IMAP::ResponseText represents texts of responses.
104-
# The text may be prefixed by the response code.
105104
#
106-
# resp_text ::= ["[" resp-text-code "]" SP] text
107-
#
108-
# ==== Fields:
109-
#
110-
# code:: Returns the response code. See ((<Net::IMAP::ResponseCode>)).
111-
#
112-
# text:: Returns the text.
105+
# The text may be prefixed by a ResponseCode.
113106
#
107+
# ResponseText is returned from TaggedResponse#data, or from
108+
# UntaggedResponse#data when the response type is a "condition" ("OK", "NO",
109+
# "BAD", "PREAUTH", or "BYE").
114110
class ResponseText < Struct.new(:code, :text)
111+
##
112+
# method: code
113+
# :call-seq: code -> ResponseCode or nil
114+
#
115+
# Returns a ResponseCode, if the response contains one
116+
117+
##
118+
# method: text
119+
# :call-seq: text -> string
120+
#
121+
# Returns the response text, not including any response code
115122
end
116123

117-
# Net::IMAP::ResponseCode represents response codes.
118-
#
119-
# resp_text_code ::= "ALERT" /
120-
# "BADCHARSET" [SP "(" astring *(SP astring) ")" ] /
121-
# capability_data / "PARSE" /
122-
# "PERMANENTFLAGS" SP "("
123-
# [flag_perm *(SP flag_perm)] ")" /
124-
# "READ-ONLY" / "READ-WRITE" / "TRYCREATE" /
125-
# "UIDNEXT" SP nz_number / "UIDVALIDITY" SP nz_number /
126-
# "UNSEEN" SP nz_number /
127-
# atom [SP 1*<any TEXT-CHAR except "]">]
128-
#
129-
# ==== Fields:
130-
#
131-
# name:: Returns the name, such as "ALERT", "PERMANENTFLAGS", or "UIDVALIDITY".
124+
# Net::IMAP::ResponseCode represents response codes. Response codes can be
125+
# retrieved from ResponseText#code and can be included in any "condition"
126+
# response: any TaggedResponse and UntaggedResponse when the response type
127+
# is a "condition" ("OK", "NO", "BAD", "PREAUTH", or "BYE").
132128
#
133-
# data:: Returns the data, if it exists.
134129
#
135130
class ResponseCode < Struct.new(:name, :data)
131+
##
132+
# method: name
133+
# :call-seq: name -> string
134+
#
135+
# Returns the response code name, such as "ALERT", "PERMANENTFLAGS", or
136+
# "UIDVALIDITY".
137+
138+
##
139+
# method: data
140+
# :call-seq: data -> object or nil
141+
#
142+
# Returns the parsed response code data, e.g: an array of capabilities
143+
# strings, an array of character set strings, a list of permanent flags,
144+
# an Integer, etc. The response #code determines what form the response
145+
# code data can take.
136146
end
137147

138148
# Net::IMAP::UIDPlusData represents the ResponseCode#data that accompanies

0 commit comments

Comments
 (0)