Module: Premailer::Rails::CSSHelper

Extended by:
CSSHelper
Included in:
CSSHelper
Defined in:
lib/premailer/rails/css_helper.rb

Constant Summary collapse

FileNotFound =
Class.new(StandardError)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cacheObject

Returns the value of attribute cache.



8
9
10
# File 'lib/premailer/rails/css_helper.rb', line 8

def cache
  @cache
end

Instance Method Details

#css_for_doc(doc) ⇒ Object

Returns all linked CSS files concatenated as string.



12
13
14
# File 'lib/premailer/rails/css_helper.rb', line 12

def css_for_doc(doc)
  css_urls_in_doc(doc).map { |url| css_for_url(url) }.join("\n")
end

#css_for_url(url) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/premailer/rails/css_helper.rb', line 16

def css_for_url(url)
  if cache_enabled?
    load_css_with_cache(url)
  else
    load_css(url)
  end
end