class MultiMail::Message::Base
Public Class Methods
new(*args, &block)
click to toggle source
Calls superclass method
# File lib/multi_mail/message/base.rb, line 4 def initialize(*args, &block) if args.empty? __setobj__(Mail::Message.new(&block)) else super end end
Public Instance Methods
body_html()
click to toggle source
# File lib/multi_mail/message/base.rb, line 17 def body_html if html_part html_part.body.decoded elsif html? body.decoded end end
body_text()
click to toggle source
# File lib/multi_mail/message/base.rb, line 25 def body_text if text_part text_part.body.decoded elsif !html? body.decoded end end
html?()
click to toggle source
@see github.com/wildbit/postmark-gem/blob/master/lib/postmark/message_extensions/mail.rb
# File lib/multi_mail/message/base.rb, line 13 def html? !!content_type && content_type.include?('text/html') end
Private Instance Methods
normalize(hash)
click to toggle source
# File lib/multi_mail/message/base.rb, line 49 def normalize(hash) hash.delete_if do |_,value| value.nil? || value.empty? || Array === value && value.all?{|v| v.nil?} end hash.keys.each do |key| # based on Hash#symbolize_keys! from Rails hash[(key.to_sym rescue key) || key] = hash.delete(key) end hash end