module Sprockets::Configuration
Attributes
This class maybe mutated and mixed in with custom helpers.
environment.context_class.instance_eval do include MyHelpers def asset_url; end end
Get and set ‘Logger` instance.
Public Instance Methods
Source
# File lib/sprockets/configuration.rb, line 23 def config=(config) raise TypeError, "can't assign mutable config" unless config.frozen? @config = config end
Source
# File lib/sprockets/configuration.rb, line 56 def digest_class config[:digest_class] end
Public: Returns a ‘Digest` implementation class.
Defaults to ‘Digest::SHA256`.
Source
# File lib/sprockets/configuration.rb, line 66 def digest_class=(klass) self.config = config.merge(digest_class: klass).freeze end
Deprecated: Assign a ‘Digest` implementation class. This maybe any Ruby `Digest::` implementation such as `Digest::SHA256` or `Digest::SHA512`.
environment.digest_class = Digest::SHA512
Source
# File lib/sprockets/configuration.rb, line 15 def initialize_configuration(parent) @config = parent.config @logger = parent.logger @context_class = Class.new(parent.context_class) end
Source
# File lib/sprockets/configuration.rb, line 41 def version config[:version] end
The ‘Environment#version` is a custom value used for manually expiring all asset caches.
Sprockets
is able to track most file and directory changes and will take care of expiring the cache for you. However, its impossible to know when any custom helpers change that you mix into the ‘Context`.
It would be wise to increment this value anytime you make a configuration change to the ‘Environment` object.
Source
# File lib/sprockets/configuration.rb, line 49 def version=(version) self.config = hash_reassoc(config, :version) { version.dup } end
Assign an environment version.
environment.version = '2.0'