class MIME::Content::Text::Plain::Parser
Parser
for Text::Plain
Constants
- HMD_RGX
Public Class Methods
new(target)
click to toggle source
# File lib/safrano/multipart.rb, line 202 def initialize(target) @state = :h @lines = [] @target = target end
Public Instance Methods
addline(line)
click to toggle source
# File lib/safrano/multipart.rb, line 208 def addline(line) @lines << line end
parse(level: 0)
click to toggle source
# File lib/safrano/multipart.rb, line 223 def parse(level: 0) return unless @lines @level = level @lines.each do |line| case @state when :h parse_head(line) when :b @target.content << line end end @lines = nil @target.level = level @target end
parse_head(line)
click to toggle source
# File lib/safrano/multipart.rb, line 212 def parse_head(line) if (hmd = HMD_RGX.match(line)) @target.hd[hmd[1].downcase] = hmd[2].strip elsif CRLF == line @state = :b else @target.content << line @state = :b end end