Skip to content

Commit 73121cf

Browse files
committed
📚 Add rdoc examples to UnparsedData, UnparsedNumericData
1 parent 4cb320f commit 73121cf

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

lib/net/imap/response_data.rb

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,15 @@ class IgnoredResponse < UntaggedResponse
7575
#
7676
# Net::IMAP::UnparsedData represents data for unknown response types or
7777
# unknown extensions to response types without a well-defined extension
78-
# grammar.
78+
# grammar. UnparsedData represents the portion of the response which the
79+
# parser has skipped over, without attempting to parse it.
80+
#
81+
# parser = Net::IMAP::ResponseParser.new
82+
# response = parser.parse "* X-UNKNOWN-TYPE can't parse this\r\n"
83+
# response => Net::IMAP::UntaggedResponse(
84+
# name: "X-UNKNOWN-TYPE",
85+
# data: Net::IMAP::UnparsedData(unparsed_data: "can't parse this"),
86+
# )
7987
#
8088
# See also: UnparsedNumericResponseData, ExtensionData, IgnoredResponse
8189
class UnparsedData < Struct.new(:unparsed_data)
@@ -93,7 +101,16 @@ class UnparsedData < Struct.new(:unparsed_data)
93101
# Net::IMAP::UnparsedNumericResponseData represents data for unhandled
94102
# response types with a numeric prefix. See the documentation for #number.
95103
#
96-
# See also: UnparsedData, ExtensionData, IgnoredResponse
104+
# parser = Net::IMAP::ResponseParser.new
105+
# response = parser.parse "* 123 X-UNKNOWN-TYPE can't parse this\r\n"
106+
# response => Net::IMAP::UntaggedResponse(
107+
# name: "X-UNKNOWN-TYPE",
108+
# data: Net::IMAP::UnparsedNumericData(
109+
# number: 123,
110+
# unparsed_data: "can't parse this"
111+
# ),
112+
# )
113+
#
97114
class UnparsedNumericResponseData < Struct.new(:number, :unparsed_data)
98115
##
99116
# method: number

0 commit comments

Comments
 (0)