Sha256: 653878ba773cf5be7dce57b9607a9b67e8d8eae7d8c50a2008ae30b5a2965127

Contents?: true

Size: 536 Bytes

Versions: 4

Compression:

Stored size: 536 Bytes

Contents

class Premailer
  module Rails
    module CSSLoaders
      module CacheLoader
        extend self

        @cache = {}

        def load(url)
          @cache[url] unless development_env?
        end

        def store(url, content)
          @cache[url] ||= content unless development_env?
        end

        def clear!
          @cache = {}
        end

        def development_env?
          defined?(::Rails) &&
            ::Rails.respond_to?(:env) &&
            ::Rails.env.development?
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
premailer-rails-1.9.7 lib/premailer/rails/css_loaders/cache_loader.rb
premailer-rails-1.9.6 lib/premailer/rails/css_loaders/cache_loader.rb
premailer-rails-1.9.5 lib/premailer/rails/css_loaders/cache_loader.rb
premailer-rails-1.9.4 lib/premailer/rails/css_loaders/cache_loader.rb