Class: AwesomeMailer::Base

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
lib/awesome_mailer/base.rb

Instance Method Summary collapse

Instance Method Details

#render(*arguments) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/awesome_mailer/base.rb', line 10

def render(*arguments)
  html_string = super
  document = Hpricot(html_string)
  stylesheets = document.search('link[@rel=stylesheet]')
  stylesheets.each do |stylesheet|
    if stylesheet['media'] =~ /^(all|handheld|screen)$/ # Must be intended for digital screens!
      apply_stylesheet!(document, stylesheet)
    end
  end
  stylesheets.remove
  document.to_html
end