Sha256: da27ef9bb310cc5a8c9df78191d0bb2ec243096924a4e82e4c1b214a7aa044e4

Contents?: true

Size: 501 Bytes

Versions: 28

Compression:

Stored size: 501 Bytes

Contents

module Linner
  class Cache < Hash
    def miss? ns, path
      asset = Asset.new path
      if self["#{ns}:#{path}"] and self["#{ns}:#{path}"].mtime == asset.mtime
        false
      else
        self["#{ns}:#{path}"] = asset
      end
    end

    def expire_by paths
      is_include_partial_styles = paths.any? do |path|
        Asset.new(path).stylesheet? and File.basename(path).start_with? "_"
      end
      self.reject! {|k, v| v.stylesheet?} if is_include_partial_styles
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
linner-0.7.3 lib/linner/cache.rb
linner-0.7.2 lib/linner/cache.rb
linner-0.7.1 lib/linner/cache.rb
linner-0.7.0 lib/linner/cache.rb
linner-0.6.7 lib/linner/cache.rb
linner-0.6.6 lib/linner/cache.rb
linner-0.6.5 lib/linner/cache.rb
linner-0.6.4 lib/linner/cache.rb