lib/email_reply_parser.rb
# Builds the fragment string, after all lines have been added.
# It also checks to see if this Fragment is hidden.  The hidden
# Fragment check reads from the bottom to the top.
#
# Any quoted Fragments or signature Fragments are marked hidden if they
# are below any visible Fragments.  Visible Fragments are expected to
# contain original content by the author.  If they are below a quoted
# Fragment, then the Fragment should be visible to give context to the
# reply.
#
#     some original text (visible)
#
#     > do you have any two's? (quoted, visible)
#
#     Go fish! (visible)
#
#     > --
#     > Player 1 (quoted, hidden)
#
#     --
#     Player 2 (signature, hidden)
#
Builds the fragment string, after all lines have been added.
It also checks to see if this Fragment is hidden.  The hidden
Fragment check reads from the bottom to the top.

Any quoted Fragments or signature Fragments are marked hidden if they
are below any visible Fragments.  Visible Fragments are expected to
contain original content by the author.  If they are below a quoted
Fragment, then the Fragment should be visible to give context to the
reply.

some original text (visible)

> do you have any two's. (quoted, visible)

Go fish. (visible)

>
> Player 1 (quoted, hidden)

Player 2 (signature, hidden)
Builds the fragment string after all lines have been added . It also checks to see if this Fragment is hidden . The hidden Fragment check reads from the bottom to the top . Any quoted Fragments or signature Fragments are marked hidden if they are below any visible Fragments . Visible Fragments are expected to contain original content by the author . If they are below a quoted Fragment then the Fragment should be visible to give context to the reply . some original text ( visible ) > do you have any two ' s . ( quoted visible ) Go fish . ( visible ) > > Player 1 ( quoted hidden ) Player 2 ( signature hidden )
def finish_fragment
      if @fragment
        @fragment.finish
        if !@found_visible
          if @fragment.quoted? || @fragment.signature? ||
              @fragment.reply_header? || @fragment.to_s.strip == EMPTY
            @fragment.hidden = true
          else
            @found_visible = true
          end
        end
        @fragments << @fragment
      end
      @fragment = nil
    end
def finish_fragment if @fragment @fragment . finish if ! @found_visible if @fragment . quoted? || @fragment . signature? || @fragment . reply_header? || @fragment . to_s . strip == EMPTY @fragment . hidden = true else @found_visible = true end end @fragments << @fragment end @fragment = nil end
Builds the fragment string, after all lines have been added.
Builds the fragment string after all lines have been added .