Class: MailExtract::Line
- Inherits:
-
Object
- Object
- MailExtract::Line
- Defined in:
- lib/mail_extract/line.rb
Constant Summary collapse
- PATTERNS =
{ /^[>]+\s?/ => :quote, /^--/ => :signature, /^-- / => :signature, /^[_]{2,}\n?/ => :signature, /^[-]{2,}\n?/ => :signature, /^sent from my (iphone|ipad)/i => :signature }
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#subtype ⇒ Object
readonly
Returns the value of attribute subtype.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(str) ⇒ Line
constructor
A new instance of Line.
-
#quote? ⇒ Boolean
Returns true if line was detected as quote.
-
#signature? ⇒ Boolean
Returns true if line was detected as signature.
-
#text? ⇒ Boolean
Returns true if line was detected as text.
Constructor Details
#initialize(str) ⇒ Line
Returns a new instance of Line.
14 15 16 17 18 19 |
# File 'lib/mail_extract/line.rb', line 14 def initialize(str) @body = str @subtype = :none detect_type(str) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/mail_extract/line.rb', line 3 def body @body end |
#subtype ⇒ Object (readonly)
Returns the value of attribute subtype.
3 4 5 |
# File 'lib/mail_extract/line.rb', line 3 def subtype @subtype end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/mail_extract/line.rb', line 3 def type @type end |
Instance Method Details
#quote? ⇒ Boolean
Returns true if line was detected as quote
29 30 31 |
# File 'lib/mail_extract/line.rb', line 29 def quote? type == :quote end |
#signature? ⇒ Boolean
Returns true if line was detected as signature
35 36 37 |
# File 'lib/mail_extract/line.rb', line 35 def signature? type == :signature end |
#text? ⇒ Boolean
Returns true if line was detected as text
23 24 25 |
# File 'lib/mail_extract/line.rb', line 23 def text? type == :text end |