class GhostInThePost::MailGhost

Attributes

email[R]
included_scripts[R]
timeout[R]
wait_event[R]

Public Class Methods

new(email, timeout=nil, wait_event=nil, included_scripts=[]) click to toggle source
# File lib/ghost_in_the_post/mail_ghost.rb, line 5
def initialize(email, timeout=nil, wait_event=nil, included_scripts=[])
  @email = email
  @timeout = timeout
  @wait_event = wait_event
  @included_scripts = Array(included_scripts).compact
end

Public Instance Methods

execute() click to toggle source
# File lib/ghost_in_the_post/mail_ghost.rb, line 12
def execute
  improve_body if email.content_type =~ /^text\/html/
  improve_html_part(email.html_part) if email.html_part
  email
end

Private Instance Methods

ghost_html(old_html) click to toggle source
# File lib/ghost_in_the_post/mail_ghost.rb, line 28
def ghost_html(old_html)
  PhantomTransform.new(old_html, timeout, wait_event, included_scripts).transform
end
improve_body() click to toggle source
# File lib/ghost_in_the_post/mail_ghost.rb, line 20
def improve_body
  email.body = ghost_html(email.body.decoded)
end
improve_html_part(html_part) click to toggle source
# File lib/ghost_in_the_post/mail_ghost.rb, line 24
def improve_html_part(html_part)
  html_part.body = ghost_html(html_part.body.decoded)
end