Module: Sprockets::Loader

Includes:
DigestUtils, Engines, Mime, PathUtils, Processing, Resolve, Transformers, URIUtils
Included in:
Base
Defined in:
lib/sprockets/loader.rb

Overview

The loader phase takes a asset URI location and returns a constructed Asset object.

Constant Summary

Constants included from DigestUtils

DigestUtils::DIGEST_SIZES, DigestUtils::NI_HASH_ALGORITHMS

Constants included from Utils

Utils::UNBOUND_METHODS_BIND_TO_ANY_OBJECT

Constants included from PathUtils

PathUtils::SEPARATOR_PATTERN

Instance Method Summary collapse

Methods included from DigestUtils

#detect_digest_class, #digest, #digest_class, #integrity_uri, #pack_base64digest, #pack_hexdigest, #pack_urlsafe_base64digest

Methods included from Engines

#engine_mime_types, #engines, #register_engine, #unwrap_engines

Methods included from Utils

#concat_javascript_sources, #dfs, #duplicable?, #hash_reassoc, #hash_reassoc1, #module_include, #normalize_extension, #string_end_with_semicolon?

Methods included from Mime

#encodings, #mime_exts, #mime_type_charset_detecter, #mime_types, #read_file, #register_encoding, #register_mime_type

Methods included from HTTPUtils

#find_best_mime_type_match, #find_best_q_match, #find_mime_type_matches, #find_q_matches, #match_mime_type?, #parse_q_values

Methods included from PathUtils

#absolute_path?, #atomic_write, #entries, #file?, #find_upwards, #path_extnames, #path_parents, #paths_split, #relative_path?, #split_subpath, #stat, #stat_directory, #stat_sorted_tree, #stat_tree

Methods included from URIUtils

#build_asset_uri, #parse_asset_uri, #valid_asset_uri?

Methods included from Processing

#bundle_processors, #bundle_reducers, #postprocessors, #preprocessors, #process_bundle_reducers, #register_bundle_metadata_reducer, #register_bundle_processor, #register_postprocessor, #register_preprocessor, #unregister_bundle_processor, #unregister_postprocessor, #unregister_preprocessor, #unwrap_bundle_processors, #unwrap_bundle_reducers, #unwrap_postprocessors, #unwrap_preprocessors

Methods included from Resolve

#locate, #resolve

Methods included from Transformers

#expand_transform_accepts, #inverted_transformers, #register_transformer, #resolve_transform_type, #transformers, #unwrap_transformer

Instance Method Details

#load(uri) ⇒ Object

Public: Load Asset by AssetURI.

uri - AssetURI

Returns Asset.



23
24
25
26
27
28
29
# File 'lib/sprockets/loader.rb', line 23

def load(uri)
  _, params = parse_asset_uri(uri)
  asset = params.key?(:id) ?
    load_asset_by_id_uri(uri) :
    load_asset_by_uri(uri)
  Asset.new(self, asset)
end