Class: EmailReplyParser::Fragment
- Inherits:
-
Struct
- Object
- Struct
- EmailReplyParser::Fragment
- Defined in:
- lib/email_reply_parser.rb
Overview
Represents a group of paragraphs in the email sharing common attributes. Paragraphs should get their own fragment if they are a quoted area or a signature.
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
This is an Array of String lines of content.
-
#hidden ⇒ Object
(also: #hidden?)
Returns the value of attribute hidden.
-
#lines ⇒ Object
readonly
This is an Array of String lines of content.
-
#quoted ⇒ Object
(also: #quoted?)
Returns the value of attribute quoted.
-
#signature ⇒ Object
(also: #signature?)
Returns the value of attribute signature.
Instance Method Summary collapse
-
#finish ⇒ Object
Builds the string content by joining the lines and reversing them.
-
#initialize(quoted, first_line) ⇒ Fragment
constructor
A new instance of Fragment.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(quoted, first_line) ⇒ Fragment
Returns a new instance of Fragment.
235 236 237 238 239 240 241 |
# File 'lib/email_reply_parser.rb', line 235 def initialize(quoted, first_line) self.signature = self.hidden = false self.quoted = quoted @lines = [first_line] @content = nil @lines.compact! end |
Instance Attribute Details
#content ⇒ Object (readonly)
This is an Array of String lines of content. Since the content is reversed, this array is backwards, and contains reversed strings.
229 230 231 |
# File 'lib/email_reply_parser.rb', line 229 def content @content end |
#hidden ⇒ Object Also known as:
Returns the value of attribute hidden
226 227 228 |
# File 'lib/email_reply_parser.rb', line 226 def hidden @hidden end |
#lines ⇒ Object (readonly)
This is an Array of String lines of content. Since the content is reversed, this array is backwards, and contains reversed strings.
229 230 231 |
# File 'lib/email_reply_parser.rb', line 229 def lines @lines end |
#quoted ⇒ Object Also known as: quoted?
Returns the value of attribute quoted
226 227 228 |
# File 'lib/email_reply_parser.rb', line 226 def quoted @quoted end |
#signature ⇒ Object Also known as: signature?
Returns the value of attribute signature
226 227 228 |
# File 'lib/email_reply_parser.rb', line 226 def signature @signature end |
Instance Method Details
#finish ⇒ Object
Builds the string content by joining the lines and reversing them.
Returns nothing.
250 251 252 253 254 |
# File 'lib/email_reply_parser.rb', line 250 def finish @content = @lines.join("\n") @lines = nil @content.reverse! end |
#inspect ⇒ Object
260 261 262 |
# File 'lib/email_reply_parser.rb', line 260 def inspect to_s.inspect end |
#to_s ⇒ Object
256 257 258 |
# File 'lib/email_reply_parser.rb', line 256 def to_s @content end |