class Sprockets::Base

‘Base` class for `Environment` and `Cached`.

def [](*args)


environment['application.js']

Preferred `find_asset` shorthand.
def [](*args)
  find_asset(*args)
end

def cache=(cache)

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

Set persistent cache store
def cache=(cache)
  @cache = Cache.new(cache, logger)
end

def cached

Return an `Cached`. Must be implemented by the subclass.
def cached
  raise NotImplementedError
end

def file_digest(path)

Returns a String digest or nil.

path - String filename or directory path.

Internal: Compute digest for path.
def file_digest(path)
  if stat = self.stat(path)
    # Caveat: Digests are cached by the path's current mtime. Its possible
    # for a files contents to have changed and its mtime to have been
    # negligently reset thus appearing as if the file hasn't changed on
    # disk. Also, the mtime is only read to the nearest second. Its
    # also possible the file was updated more than once in a given second.
    cache.fetch(['file_digest', path, stat.mtime.to_i]) do
      self.stat_digest(path, stat)
    end
  end
end

def find_all_linked_assets(path, options = {})

def find_all_linked_assets(path, options = {})
  return to_enum(__method__, path, options) unless block_given?
  asset = find_asset(path, options)
  return unless asset
  yield asset
  stack = asset.links.to_a
  while uri = stack.shift
    yield asset = load(uri)
    stack = asset.links.to_a + stack
  end
  nil
end

def find_asset(path, options = {})

Find asset by logical path or expanded path.
def find_asset(path, options = {})
  if uri = locate(path, options)
    load(uri)
  end
end

def inspect

Pretty inspect
def inspect
  "#<#{self.class}:0x#{object_id.to_s(16)} " +
    "root=#{root.to_s.inspect}, " +
    "paths=#{paths.inspect}>"
end