class EmailReplyParser::Fragment

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.

Attributes

content[R]

This is reserved for the joined String that is build when this Fragment is finished.

current_block[R]

Array of string lines that is being processed not having an empty line.

lines[R]

Public Class Methods

new() click to toggle source
# File lib/email_reply_parser.rb, line 415
def initialize
  self.quoted = self.signature = self.reply_header = self.hidden = false
  @lines = []
  @current_block = []
  @content = nil
end

Public Instance Methods

add_line(line) click to toggle source
# File lib/email_reply_parser.rb, line 427
def add_line(line)
  return unless line
  @lines.insert(0, line)
  if line == ""
    @current_block.clear
  else
    @current_block.insert(0, line)
  end
end
finish() click to toggle source

Builds the string content by joining the lines and reversing them.

# File lib/email_reply_parser.rb, line 442
def finish
  @content = @lines.join("\n")
  @lines = @current_block = nil
end
inspect() click to toggle source
# File lib/email_reply_parser.rb, line 451
def inspect
  "#{super.inspect} : #{to_s.inspect}"
end
to_s() click to toggle source
# File lib/email_reply_parser.rb, line 447
def to_s
  @lines ? @lines.join("\n") : @content
end