Class Sprockets::Base
In: lib/sprockets/base.rb
Parent: Object

`Base` class for `Environment` and `Index`.

Methods

Included Modules

Digest Caching Processing Server Trail

Attributes

cache  [R]  Get persistent cache store
context_class  [R]  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

Preferred `find_asset` shorthand.

    environment['application.js']

Internal. Return a `AssetAttributes` for `path`.

Set persistent cache store

The cache store must implement a pair of getters and setters. Either `get(key)`/`set(key, value)`, `[key]`/`[key]=value`, `read(key)`/`write(key, value)`.

Internal. Return content type of `path`.

Works like `Dir.entries`.

Subclasses may cache this method.

Read and compute digest of filename.

Subclasses may cache this method.

Find asset by logical path or expanded path.

Return an `Index`. Must be implemented by the subclass.

Works like `File.stat`.

Subclasses may cache this method.

Protected Instance methods

Clear index after mutating state. Must be implemented by the subclass.

[Validate]