Module: Sprockets::Configuration

### Home Classes Methods

### In Files

- lib/sprockets/configuration.rb

### Methods

- #config=
- #digest_class
- #digest_class=
- #initialize_configuration
- #version
- #version=

### Included Modules

- Sprockets::Paths
- Sprockets::Mime
- Sprockets::Engines
- Sprockets::Transformers
- Sprockets::Processing
- Sprockets::Compressing
- Sprockets::Dependencies
- Sprockets::Utils

### Class/Module Index

Quicksearch

- Sprockets
- Sprockets::ArgumentError
- Sprockets::Asset
- Sprockets::Autoload
- Sprockets::Base
- Sprockets::Bower
- Sprockets::Bundle
- Sprockets::Cache
- Sprockets::Cache::FileStore
- Sprockets::Cache::GetWrapper
- Sprockets::Cache::HashWrapper
- Sprockets::Cache::MemoryStore
- Sprockets::Cache::NullStore
- Sprockets::Cache::ReadWriteWrapper
- Sprockets::Cache::Wrapper
- Sprockets::CachedEnvironment
- Sprockets::ClosureCompressor
- Sprockets::CoffeeScriptProcessor
- Sprockets::CoffeeScriptTemplate
- Sprockets::Compressing
- Sprockets::Configuration
- Sprockets::ContentTypeMismatch
- Sprockets::Context
- Sprockets::ConversionError
- Sprockets::Dependencies
- Sprockets::DigestUtils
- Sprockets::DirectiveProcessor
- Sprockets::ERBProcessor
- Sprockets::ERBTemplate
- Sprockets::EcoProcessor
- Sprockets::EcoTemplate
- Sprockets::EjsProcessor
- Sprockets::EjsTemplate
- Sprockets::EncodingUtils
- Sprockets::Engines
- Sprockets::Environment
- Sprockets::Error
- Sprockets::FileNotFound
- Sprockets::FileOutsidePaths
- Sprockets::FileReader
- Sprockets::HTTPUtils
- Sprockets::Index
- Sprockets::JstProcessor
- Sprockets::LegacyProcProcessor
- Sprockets::LegacyTiltProcessor
- Sprockets::Loader
- Sprockets::Manifest
- Sprockets::ManifestUtils
- Sprockets::Mime
- Sprockets::NotFound
- Sprockets::NotImplementedError
- Sprockets::PathDependencyUtils
- Sprockets::PathDigestUtils
- Sprockets::PathUtils
- Sprockets::Paths
- Sprockets::Processing
- Sprockets::ProcessorUtils
- Sprockets::Resolve
- Sprockets::SassCompressor
- Sprockets::SassProcessor
- Sprockets::SassProcessor::CacheStore
- Sprockets::SassProcessor::Functions
- Sprockets::SassTemplate
- Sprockets::ScssProcessor
- Sprockets::ScssTemplate
- Sprockets::Server
- Sprockets::Transformers
- Sprockets::URITar
- Sprockets::URIUtils
- Sprockets::UglifierCompressor
- Sprockets::UnloadedAsset
- Sprockets::Utils
- Sprockets::YUICompressor
- Rake
- Rake::SprocketsTask

No matching classes.

# Sprockets::Configuration

### Attributes

computed_config[RW]
config[R]
context_class[R]

Deprecated: Get `Context` class.

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 25
    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 58
    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::MD5`.

    environment.digest_class = Digest::MD5

    # File lib/sprockets/configuration.rb, line 68
    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 14
    def initialize_configuration(parent)
      @config = parent.config
      @computed_config = parent.computed_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 43
    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 51
    def version=(version)
      self.config = hash_reassoc(config, :version) { version.dup }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.