Sha256: 104e14e2ed41f85ea154457ce5f8d072258cb6037920c2734b82eeb05054944c
Contents?: true
Size: 794 Bytes
Versions: 8
Compression:
Stored size: 794 Bytes
Contents
require 'mail' module Email; end module Email::Mboxrd class Message attr_reader :supplied_body def initialize(supplied_body) @supplied_body = supplied_body.clone @supplied_body.force_encoding('binary') if RUBY_VERSION >= '1.9.0' end def to_s 'From ' + from + "\n" + mboxrd_body + "\n" end private def parsed @parsed ||= Mail.new(supplied_body) end def from parsed.from[0] + ' ' + asctime end def mboxrd_body return @mboxrd_body if @mboxrd_body @mboxrd_body = supplied_body.gsub(/\n(>*From)/, "\n>\\1") @mboxrd_body += "\n" unless @mboxrd_body.end_with?("\n") @mboxrd_body end def asctime date ? date.asctime : '' end def date parsed.date end end end
Version data entries
8 entries across 8 versions & 1 rubygems