Module: Sprockets::PathDigestUtils

Defined in:
lib/volt/server/template_handlers/sprockets_component_handler.rb

Instance Method Summary collapse

Instance Method Details

#stat_digest(path, stat) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/volt/server/template_handlers/sprockets_component_handler.rb', line 96

def stat_digest(path, stat)
  if stat.directory?
    # If its a directive, digest the list of filenames
    digest_class.digest(self.entries(path).join(','))
  elsif stat.file?
    # If its a file, digest the contents
    digest_class.file(path.to_s).digest
  elsif stat.stub?
    # Component lookup, custom digest that always invalidates
    return stat.digest
  else
    raise TypeError, "stat was not a directory or file: #{stat.ftype}"
  end
end