class RMail::StreamHandler

Overview

An RMail::StreamHandler documents the set of methods a RMail::StreamParser handler must implement. See RMail::StreamParser.parse. This is a low level interface to the RMail message parser.

Order of Method Calls (Grammar)

Calls to the methods of this class follow a specific grammar, described informally below. The words in all caps are productions in the grammar, while the lower case words are method calls to this object.

MESSAGE
mbox_from

*( header_field )

( BODY / MULTIPART_BODY )

BODY

*body_begin *( body_chunk ) body_end

MULTIPART_BODY

multipart_body_begin *( preamble_chunk ) *( part_begin MESSAGE part_end) *( epilogue_chunk ) multipart_body_end

Order of Method Calls (English)

If the grammar above is not clear, here is a description in English.

The parser begins calling header_field, possibly calling mbox_from for the first line. Then it determines if the message was a MIME multipart message.

If the message is a not a MIME multipart, the parser calls body_begin once, then body_chunk any number of times, then body_end.

If the message header is a MIME multipart message, then multipart_body_begin is called, followed by any number of calls to preamble_chunk. Then for each part parsed, part_begin is called, followed by a recursive set of calls described by the “MESSAGE” production above, and then part_end. After all parts are parsed, any number of calls to epilogue_chunk are followed by a single call to multipart_body_end.

The recursive nature of MIME multipart messages is represented by the recursive invocation of the “MESSAGE” production in the grammar above.