module Sprockets::Configuration
Attributes
config[R]
context_class[R]
This class maybe mutated and mixed in with custom helpers.
environment.context_class.instance_eval do include MyHelpers def asset_url; end end
logger[RW]
Get and set ‘Logger` instance.
Public Instance Methods
config=(config)
click to toggle source
# File lib/sprockets/configuration.rb, line 23 def config=(config) raise TypeError, "can't assign mutable config" unless config.frozen? @config = config end
digest_class()
click to toggle source
Public: Returns a ‘Digest` implementation class.
Defaults to ‘Digest::SHA256`.
# File lib/sprockets/configuration.rb, line 56 def digest_class config[:digest_class] end
digest_class=(klass)
click to toggle source
Deprecated: Assign a ‘Digest` implementation class. This maybe any Ruby `Digest::` implementation such as `Digest::SHA256` or `Digest::SHA512`.
environment.digest_class = Digest::SHA512
# File lib/sprockets/configuration.rb, line 66 def digest_class=(klass) self.config = config.merge(digest_class: klass).freeze end
initialize_configuration(parent)
click to toggle 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
version()
click to toggle source
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.
# File lib/sprockets/configuration.rb, line 41 def version config[:version] end
version=(version)
click to toggle source
Assign an environment version.
environment.version = '2.0'
# File lib/sprockets/configuration.rb, line 49 def version=(version) self.config = hash_reassoc(config, :version) { version.dup } end