class CriticalPathCssWorker::Worker

Constants

CRITICAL_CSS_CACHE_NAMESPACE

Public Class Methods

cache_critical_css(url, critical_css_present) click to toggle source
# File lib/critical_path_css_worker/worker.rb, line 17
def self.cache_critical_css(url, critical_css_present)
  puts "cache_critical_css(url,...) #{url}"
  path = URI(url).path

  return if critical_css_present && CacheState.fresh?(path)
  return if CacheState.processing?(path)

  CacheState.processing(path)
  puts "CacheCriticalCssWorker.perform_async(url) #{url}"
  Worker.perform_async(url)
end

Public Instance Methods

perform(url) click to toggle source
# File lib/critical_path_css_worker/worker.rb, line 10
def perform(url)
  puts "CacheCriticalCssWorker.perform(url) #{url}"
  path = URI(url).path
  CriticalPathCss.generate(path)
  CacheState.fresh(path)
end