Sha256: 7d0a4d8b2d05df021c9809ad8db4eac8acfa21be454436aff21ba982cffe7ce5
Contents?: true
Size: 717 Bytes
Versions: 1
Compression:
Stored size: 717 Bytes
Contents
module MailExtract class Line attr_reader :body, :type PATTERNS = { /^[>]+\s?/ => :quote, /^--/ => :signature, /^-- / => :signature, /^[_]{2,}\n?/ => :signature, /^[-]{2,}\n?/ => :signature } def initialize(str) @body = str detect_type(str) end private def detect_type(line) # Detects the start line of quote text if line.strip =~ /^On/ && line =~ /at [\d:]+/ && line.strip =~ /wrote:?\z/ @type = :quote return end @type = :text PATTERNS.each_pair do |p,t| if line =~ p @type = t break end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mail_extract-0.1.0 | lib/mail_extract/line.rb |