Class: PremailerRails::Premailer
- Inherits:
-
Premailer
- Object
- Premailer
- PremailerRails::Premailer
- Defined in:
- lib/premailer-rails3/premailer.rb
Instance Method Summary collapse
-
#initialize(html) ⇒ Premailer
constructor
A new instance of Premailer.
Constructor Details
#initialize(html) ⇒ Premailer
Returns a new instance of Premailer.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/premailer-rails3/premailer.rb', line 3 def initialize(html) # In order to pass the CSS as string to super it is necessary to access # the parsed HTML beforehand. To do so, the adapter needs to be # initialized. The ::Premailer::Adaptor handles the discovery of a # suitable adaptor (Nokogiri or Hpricot). To make load_html work, an # adaptor needs to be included and @options[:with_html_string] needs to be # set. For further information, refer to ::Premailer#initialize. @options = PremailerRails.config.merge(:with_html_string => true) ::Premailer.send(:include, Adapter.find(Adapter.use)) doc = load_html(html) = @options.merge(:css_string => CSSHelper.css_for_doc(doc)) super(html, ) end |