module Sprockets::Digest
def digest
digests. Any change in the environment digest will affect all of
The value also provides a seed digest for all `Asset`
cached assets.
than in the same. Two equal `Environment`s can share the same
useful for comparing environment states between processes rather
same digest value they can be treated as equal. This is more
This value serves two purposes. If two `Environment`s have the
Returns a `Digest` instance for the `Environment`.
def digest # Compute the initial digest using the implementation class. The # Sprockets release version and custom environment version are # mixed in. So any new releases will affect all your assets. @digest ||= digest_class.new.update(VERSION).update(version.to_s) # Returned a dupped copy so the caller can safely mutate it with `.update` @digest.dup end
def digest_class
Returns a `Digest` implementation class.
def digest_class @digest_class end
def digest_class=(klass)
environment.digest_class = Digest::SHA1
`Digest::SHA1`.
`Digest::` implementation such as `Digest::MD5` or
Assign a `Digest` implementation class. This maybe any Ruby
def digest_class=(klass) expire_index! @digest_class = klass end
def version
It would be wise to increment this value anytime you make a
into the `Context`.
impossible to know when any custom helpers change that you mix
will take care of expiring the cache for you. However, its
Sprockets is able to track most file and directory changes and
expiring all asset caches.
The `Environment#version` is a custom value used for manually
def version @version end
def version=(version)
environment.version = '2.0'
Assign an environment version.
def version=(version) expire_index! @version = version end