Sha256: e5581c7e868d2f190f351efdd03ceb46f7899dfba93c64d1a4136c8ed6b9c7b6
Contents?: true
Size: 733 Bytes
Versions: 2
Compression:
Stored size: 733 Bytes
Contents
module LetterOpener class Message attr_reader :mail def initialize(location, mail, part = nil) @location = location @mail = mail @part = part end def render FileUtils.mkdir_p(@location) File.open(filepath, 'w') do |f| f.write ERB.new(template).result(binding) end end def template File.read(File.expand_path("../message.html.erb", __FILE__)) end def filepath File.join(@location, "#{type}.html") end def content_type @part && @part.content_type || @mail.content_type end def body (@part && @part.body || @mail.body).to_s end def type content_type =~ /html/ ? "rich" : "plain" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
letter_opener-0.0.2 | lib/letter_opener/message.rb |
letter_opener-0.0.1 | lib/letter_opener/message.rb |