Class: EmailReplyParser
- Inherits:
-
Object
- Object
- EmailReplyParser
- Defined in:
- lib/email_reply_parser.rb
Overview
EmailReplyParser is a small library to parse plain text email content. The goal is to identify which fragments are quoted, part of a signature, or original body content. We want to support both top and bottom posters, so no simple “REPLY ABOVE HERE” content is used.
Beyond RFC 5322 (which is handled by the [Ruby mail gem]), there aren’t any real standards for how emails are created. This attempts to parse out common conventions for things like replies:
this is some text
On <date>, <author> wrote:
> blah blah
> blah blah
… and signatures:
this is some text
--
Bob
http://homepage.com/~bob
Each of these are parsed into Fragment objects.
EmailReplyParser also attempts to figure out which of these blocks should be hidden from users.
[mail]: github.com/mikel/mail
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.5.0"
Class Method Summary collapse
-
.parse_reply(text) ⇒ Object
Public: Get the text of the visible portions of the given email body.
-
.read(text) ⇒ Object
Public: Splits an email body into a list of Fragments.
Class Method Details
.parse_reply(text) ⇒ Object
Public: Get the text of the visible portions of the given email body.
text - A String email body.
Returns a String.
49 50 51 |
# File 'lib/email_reply_parser.rb', line 49 def self.parse_reply(text) self.read(text).visible_text end |