Class: Net::IMAP::InvalidParseData
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | lib/net/imap/response_data.rb |
Overview
Note: This represents an intentionally unstable API. Where instances of this class are returned, future releases may return a different (incompatible) object without deprecation or warning.
When the response parser encounters a recoverable error,
InvalidParseData represents that portion of the response which
could not be parsed, allowing the parser to parse the remainder of the
response. InvalidParseData is always associated with a ResponseParseError
which has been rescued.
This could be caused by a malformed server response, by a bug in
ResponseParser, or by an unsupported extension to the response
syntax. For example, if a server supports UIDPLUS, but sends an invalid
COPYUID response code:
parser = Net::IMAP::ResponseParser.new
parsed = parser.parse "* OK [COPYUID 701 ] copied one message\r\n"
parsed => {
data: Net::IMAP::ResponseText(
code: Net::IMAP::ResponseCode(
name: "COPYUID",
data: Net::IMAP::InvalidParseData(
parse_error: Net::IMAP::ResponseParseError,
unparsed_data: "701 ",
parsed_data: nil,
)
)
)
}
In this example, although [COPYUID 701 ] uses valid syntax for a
generic ResponseCode, it is invalid syntax for a COPYUID response
code.
See also: UnparsedData, ExtensionData
Instance Method Summary
-
#parse_error ⇒ ResponseParseError
Returns the rescued
ResponseParseError. -
#parsed_data
May return a partial parse result for unparsed_data, which had already been parsed before the parse_error.
-
#unparsed_data ⇒ String
Returns the raw string which was skipped over by the parser.
Instance Method Details
#parse_error ⇒ ResponseParseError
Returns the rescued ResponseParseError.
# File 'lib/net/imap/response_data.rb', line 135
rdoc_method :method: parse_error
#parsed_data
May return a partial parse result for unparsed_data, which had already been parsed before the parse_error.
# File 'lib/net/imap/response_data.rb', line 147
rdoc_method :method: parsed_data
#unparsed_data ⇒ String
Returns the raw string which was skipped over by the parser.
# File 'lib/net/imap/response_data.rb', line 141
rdoc_method :method: unparsed_data