Class: Sprockets::Index

### Home Classes Methods

### In Files

- lib/sprockets/cached_environment.rb

### Parent

Sprockets::Base

### Methods

- ::new
- #_entries
- #_load
- #_processor_cache_key
- #_resolve_dependency
- #_stat
- #cached
- #entries
- #index
- #load
- #processor_cache_key
- #resolve_dependency
- #stat

### 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::Index

`Cached` is a special cached version of `Environment`.

The expection is that all of its file system methods are cached for the instances lifetime. This makes `Cached` much faster. This behavior is ideal in production environments where the file system is immutable.

`Cached` should not be initialized directly. Instead use `Environment#cached`.

### Public Class Methods

new(environment) click to toggle source

    # File lib/sprockets/cached_environment.rb, line 14
    def initialize(environment)
      initialize_configuration(environment)

      @cache   = environment.cache
      @stats   = Hash.new { |h, k| h[k] = _stat(k) }
      @entries = Hash.new { |h, k| h[k] = _entries(k) }
      @uris    = Hash.new { |h, k| h[k] = _load(k) }

      @processor_cache_keys  = Hash.new { |h, k| h[k] = _processor_cache_key(k) }
      @resolved_dependencies = Hash.new { |h, k| h[k] = _resolve_dependency(k) }
    end

### Public Instance Methods

_entries(path) click to toggle source

Internal: Cache Environment#entries

Alias for: entries
_load(uri) click to toggle source

Internal: Cache Environment#load

Alias for: load
_processor_cache_key(str) click to toggle source

Internal: Cache Environment#processor_cache_key

Alias for: processor_cache_key
_resolve_dependency(str) click to toggle source

Internal: Cache Environment#resolve_dependency

Alias for: resolve_dependency
_stat(path) click to toggle source

Internal: Cache Environment#stat

Alias for: stat
cached() click to toggle source

No-op return self as cached environment.

    # File lib/sprockets/cached_environment.rb, line 27
    def cached
      self
    end

Also aliased as: index
entries(path) click to toggle source

    # File lib/sprockets/cached_environment.rb, line 34
    def entries(path)
      @entries[path]
    end

Also aliased as: _entries
index() click to toggle source
Alias for: cached
load(uri) click to toggle source

    # File lib/sprockets/cached_environment.rb, line 46
    def load(uri)
      @uris[uri]
    end

Also aliased as: _load
processor_cache_key(str) click to toggle source

    # File lib/sprockets/cached_environment.rb, line 52
    def processor_cache_key(str)
      @processor_cache_keys[str]
    end

Also aliased as: _processor_cache_key
resolve_dependency(str) click to toggle source

    # File lib/sprockets/cached_environment.rb, line 58
    def resolve_dependency(str)
      @resolved_dependencies[str]
    end

Also aliased as: _resolve_dependency
stat(path) click to toggle source

    # File lib/sprockets/cached_environment.rb, line 40
    def stat(path)
      @stats[path]
    end

Also aliased as: _stat

[Validate]

Generated with the Darkfish Rdoc Generator 2.