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 }
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#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.
13 14 15 16 |
# File 'lib/mail_extract/line.rb', line 13 def initialize(str) @body = str 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 |
#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
26 27 28 |
# File 'lib/mail_extract/line.rb', line 26 def quote? type == :quote end |
#signature? ⇒ Boolean
Returns true if line was detected as signature
32 33 34 |
# File 'lib/mail_extract/line.rb', line 32 def signature? type == :signature end |
#text? ⇒ Boolean
Returns true if line was detected as text
20 21 22 |
# File 'lib/mail_extract/line.rb', line 20 def text? type == :text end |