Class: Linner::Cache

Inherits:
Hash
  • Object
show all
Defined in:
lib/linner/cache.rb

Instance Method Summary collapse

Methods included from HashRecursiveMerge

#rmerge!

Instance Method Details

#expire_by(paths) ⇒ Object



12
13
14
15
16
17
# File 'lib/linner/cache.rb', line 12

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

#miss?(ns, path) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
# File 'lib/linner/cache.rb', line 3

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