"DTD/xhtml1-strict.dtd">
Class RMail::Parser
In: lib/rmail/parser/pushbackreader.rb
lib/rmail/parser/multipart.rb
lib/rmail/parser.rb
Parent: Object

The RMail::Parser class creates RMail::Message objects from Ruby IO objects or strings.

To parse from a string:

  message = RMail::Parser.read(the_string)

To parse from an IO object:

  message = File.open('my-message') { |f|
    RMail::Parser.read(f)
  }

You can also parse from STDIN, etc.

  message = RMail::Parser.read(STDIN)

In all cases, the parser consumes all input.

Methods
new    parse    read   
Attributes
:chunk_size  [RW] 

Change the chunk size used to read the message. This is useful mostly for testing.

Classes and Modules
Class RMail::Parser::Error
Class RMail::Parser::MultipartReader
Class RMail::Parser::PushbackReader
Public Class methods
new(message_class = RMail::Message)

Creates a new parser. Messages of message_class will be created by the parser. By default, the parser will create RMail::Message objects.

FIXME: document exactly the API message_class must implement in order to be functional.

read(input)

Parse a message from the IO object io and return a new message. The io object can also be a string. This is just shorthand for:

  RMail::Parser.new.parse(io)
Public Instance methods
parse(input)

Parse a message from the IO object io and return a new message. The io object can also be a string.