Class: AwesomeMailer::Renderer
- Inherits:
-
Object
- Object
- AwesomeMailer::Renderer
- Defined in:
- lib/awesome_mailer/renderer.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
Returns the value of attribute document.
Instance Method Summary collapse
-
#initialize(document_string) ⇒ Renderer
constructor
A new instance of Renderer.
- #to_html ⇒ Object
Constructor Details
#initialize(document_string) ⇒ Renderer
Returns a new instance of Renderer.
5 6 7 8 9 10 11 12 13 |
# File 'lib/awesome_mailer/renderer.rb', line 5 def initialize(document_string) self.document = Nokogiri::HTML.parse(document_string) stylesheets = document.search('link[@rel=stylesheet]') stylesheets.each do |stylesheet| # Must be intended for digital screens! load_stylesheet(stylesheet) if stylesheet['media'] =~ /^(all|handheld|screen)$/ end apply_css!(document) end |
Instance Attribute Details
#document ⇒ Object
Returns the value of attribute document.
3 4 5 |
# File 'lib/awesome_mailer/renderer.rb', line 3 def document @document end |
Instance Method Details
#to_html ⇒ Object
15 16 17 |
# File 'lib/awesome_mailer/renderer.rb', line 15 def to_html document.to_html end |