lib/sprockets/base.rb in sprockets-3.2.0 vs lib/sprockets/base.rb in sprockets-3.3.0

- old
+ new

@@ -8,10 +8,11 @@ require 'sprockets/path_digest_utils' require 'sprockets/path_dependency_utils' require 'sprockets/path_utils' require 'sprockets/resolve' require 'sprockets/server' +require 'sprockets/loader' module Sprockets # `Base` class for `Environment` and `Cached`. class Base include PathUtils, PathDependencyUtils, PathDigestUtils, DigestUtils @@ -46,12 +47,13 @@ def file_digest(path) if stat = self.stat(path) # Caveat: Digests are cached by the path's current mtime. Its possible # for a files contents to have changed and its mtime to have been # negligently reset thus appearing as if the file hasn't changed on - # disk. Also, the mtime is only read to the nearest second. Its + # disk. Also, the mtime is only read to the nearest second. It's # also possible the file was updated more than once in a given second. - cache.fetch("file_digest:#{path}:#{stat.mtime.to_i}") do + key = UnloadedAsset.new(path, self).file_digest_key(stat.mtime.to_i) + cache.fetch(key) do self.stat_digest(path, stat) end end end