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.
241 242 243 244 245 246 247 |
# File 'lib/email_reply_parser.rb', line 241 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.
235 236 237 |
# File 'lib/email_reply_parser.rb', line 235 def content @content end |
#hidden ⇒ Object Also known as:
Returns the value of attribute hidden
232 233 234 |
# File 'lib/email_reply_parser.rb', line 232 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.
235 236 237 |
# File 'lib/email_reply_parser.rb', line 235 def lines @lines end |
#quoted ⇒ Object Also known as: quoted?
Returns the value of attribute quoted
232 233 234 |
# File 'lib/email_reply_parser.rb', line 232 def quoted @quoted end |
#signature ⇒ Object Also known as: signature?
Returns the value of attribute signature
232 233 234 |
# File 'lib/email_reply_parser.rb', line 232 def signature @signature end |
Instance Method Details
#finish ⇒ Object
Builds the string content by joining the lines and reversing them.
Returns nothing.
256 257 258 259 260 |
# File 'lib/email_reply_parser.rb', line 256 def finish @content = @lines.join("\n") @lines = nil @content.reverse! end |
#inspect ⇒ Object
266 267 268 |
# File 'lib/email_reply_parser.rb', line 266 def inspect to_s.inspect end |
#to_s ⇒ Object
262 263 264 |
# File 'lib/email_reply_parser.rb', line 262 def to_s @content end |