Skip to content

Commit f167e3c

Browse files
committed
📚 Document fields for Tagged/Untagged/Continuation
* 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 e500d28 commit f167e3c

File tree

1 file changed

+60
-38
lines changed

1 file changed

+60
-38
lines changed

lib/net/imap/response_data.rb

Lines changed: 60 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,47 @@ class IMAP < Protocol
1010
# ready to accept the continuation of a command from the client. The
1111
# remainder of this response is a line of text.
1212
#
13-
# continue_req ::= "+" SPACE (resp_text / base64)
14-
#
15-
# ==== Fields:
16-
#
17-
# data:: Returns the data (Net::IMAP::ResponseText).
18-
#
19-
# raw_data:: Returns the raw data string.
2013
class ContinuationRequest < Struct.new(:data, :raw_data)
14+
##
15+
# method: data
16+
# :call-seq: data -> ResponseText
17+
#
18+
# Returns a ResponseText object
19+
20+
##
21+
# method: raw_data
22+
# :call-seq: raw_data -> string
23+
#
24+
# the raw response data
2125
end
2226

2327
# Net::IMAP::UntaggedResponse represents untagged responses.
2428
#
2529
# Data transmitted by the server to the client and status responses
2630
# that do not indicate command completion are prefixed with the token
27-
# "*", and are called untagged responses.
28-
#
29-
# response_data ::= "*" SPACE (resp_cond_state / resp_cond_bye /
30-
# mailbox_data / message_data / capability_data)
31-
#
32-
# ==== Fields:
31+
# <tt>"*"</tt>, and are called untagged responses.
3332
#
34-
# name:: Returns the name, such as "FLAGS", "LIST", or "FETCH".
35-
#
36-
# data:: Returns the data such as an array of flag symbols,
37-
# a ((<Net::IMAP::MailboxList>)) object.
38-
#
39-
# raw_data:: Returns the raw data string.
4033
class UntaggedResponse < Struct.new(:name, :data, :raw_data)
34+
##
35+
# method: name
36+
# :call-seq: name -> string
37+
#
38+
# The uppercase response name, e.g. "FLAGS", "LIST", "FETCH", etc.
39+
40+
##
41+
# method: data
42+
# :call-seq: data -> object or nil
43+
#
44+
# The parsed response data, e.g: an array of flag symbols, an array of
45+
# capabilities strings, a ResponseText object, a MailboxList object, a
46+
# FetchData object, a Namespaces object, etc. The response #name
47+
# determines what form the data can take.
48+
49+
##
50+
# method: raw_data
51+
# :call-seq: raw_data -> string
52+
#
53+
# The raw response data.
4154
end
4255

4356
# Net::IMAP::IgnoredResponse represents intentionally ignored responses.
@@ -47,10 +60,12 @@ class UntaggedResponse < Struct.new(:name, :data, :raw_data)
4760
#
4861
# It matches no IMAP standard.
4962
#
50-
# ==== Fields:
51-
#
52-
# raw_data:: Returns the raw data string.
5363
class IgnoredResponse < Struct.new(:raw_data)
64+
##
65+
# method: raw_data
66+
# :call-seq: raw_data -> string
67+
#
68+
# The raw response data.
5469
end
5570

5671
# Net::IMAP::TaggedResponse represents tagged responses.
@@ -59,23 +74,30 @@ class IgnoredResponse < Struct.new(:raw_data)
5974
# failure of the operation. It is tagged with the same tag as the
6075
# client command which began the operation.
6176
#
62-
# response_tagged ::= tag SPACE resp_cond_state CRLF
63-
#
64-
# tag ::= 1*<any ATOM_CHAR except "+">
65-
#
66-
# resp_cond_state ::= ("OK" / "NO" / "BAD") SPACE resp_text
67-
#
68-
# ==== Fields:
69-
#
70-
# tag:: Returns the tag.
71-
#
72-
# name:: Returns the name, one of "OK", "NO", or "BAD".
73-
#
74-
# data:: Returns the data. See ((<Net::IMAP::ResponseText>)).
75-
#
76-
# raw_data:: Returns the raw data string.
77-
#
7877
class TaggedResponse < Struct.new(:tag, :name, :data, :raw_data)
78+
##
79+
# method: tag
80+
# :call-seq: tag -> string
81+
#
82+
# Returns the command tag
83+
84+
##
85+
# method: name
86+
# :call-seq: name -> string
87+
#
88+
# Returns the name, one of "OK", "NO", or "BAD".
89+
90+
##
91+
# method: data
92+
# :call-seq: data -> ResponseText
93+
#
94+
# Returns a ResponseText object
95+
96+
##
97+
# method: raw_data
98+
# :call-seq: raw_data -> string
99+
#
100+
# The raw response data.
79101
end
80102

81103
# Net::IMAP::ResponseText represents texts of responses.

0 commit comments

Comments
 (0)