Class: AssetFingerprinter::Fingerprinter::Digest

Inherits:
Object
  • Object
show all
Defined in:
lib/asset_fingerprinter/fingerprinter.rb

Instance Method Summary collapse

Constructor Details

#initializeDigest

Digests a file and returns the cachebusted path



7
8
9
# File 'lib/asset_fingerprinter/fingerprinter.rb', line 7

def initialize
  @cache = Hash.new{ |hash,key| hash[key] = ::Digest::MD5.hexdigest(File.read(key)) }
end

Instance Method Details

#call(path) ⇒ Object



11
12
13
# File 'lib/asset_fingerprinter/fingerprinter.rb', line 11

def call(path)
  @cache[path]
end