Module: RMail::Mailbox
- Defined in:
- lib/rmail/mailbox.rb,
lib/rmail/mailbox/mboxreader.rb
Overview
The RMail::Mailbox module contains a few methods that are useful for working with mailboxes.
Defined Under Namespace
Classes: MBoxReader
Class Method Summary collapse
-
.parse_mbox(input, line_separator = $/) ⇒ Object
Parse a Unix mbox style mailbox.
Class Method Details
.parse_mbox(input, line_separator = $/) ⇒ Object
Parse a Unix mbox style mailbox. These mailboxes searate individual messages with a line beginning with the string “From ”.
If a block is given, yields to the block with the raw message (a string), otherwise an array of raw message strings is returned.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/rmail/mailbox.rb', line 45 def parse_mbox(input, line_separator = $/) require 'rmail/mailbox/mboxreader' retval = [] RMail::Mailbox::MBoxReader.new(input, line_separator). { |reader| = reader.read(nil) if block_given? yield else retval << end } return block_given? ? nil : retval end |