class Roadie::Rails::MailInliner

Attributes

email[R]
options[R]

Public Class Methods

new(email, options) click to toggle source
# File lib/roadie/rails/mail_inliner.rb, line 6
def initialize(email, options)
  @email = email
  @options = options
end

Public Instance Methods

execute() click to toggle source
# File lib/roadie/rails/mail_inliner.rb, line 11
def execute
  if options
    improve_body if email.content_type =~ /^text\/html/
    improve_html_part(email.html_part) if email.html_part
  end
  email
end

Private Instance Methods

improve_body() click to toggle source
# File lib/roadie/rails/mail_inliner.rb, line 20
def improve_body
  email.body = transform_html(email.body.decoded)
end
improve_html_part(html_part) click to toggle source
# File lib/roadie/rails/mail_inliner.rb, line 24
def improve_html_part(html_part)
  html_part.body = transform_html(html_part.body.decoded)
end
transform_html(old_html) click to toggle source
# File lib/roadie/rails/mail_inliner.rb, line 28
def transform_html(old_html)
  DocumentBuilder.build(old_html, options).transform
end