`Trail` is an internal mixin whose public methods are exposed on the `Environment` and `Index` classes.
Append a `path` to the `paths` list.
Paths at the beginning of the `Array` have a higher priority.
# File lib/sprockets/trail.rb, line 38 38: def append_path(path) 39: expire_index! 40: @trail.append_path(path) 41: end
Clear all paths and start fresh.
There is no mechanism for reordering paths, so its best to completely wipe the paths list and reappend them in the order you want.
# File lib/sprockets/trail.rb, line 48 48: def clear_paths 49: expire_index! 50: @trail.paths.dup.each { |path| @trail.remove_path(path) } 51: end
Returns an `Array` of extensions.
These extensions maybe omitted from logical path searches.
# => [".js", ".css", ".coffee", ".sass", ...]
# File lib/sprockets/trail.rb, line 59 59: def extensions 60: trail.extensions.dup 61: end
Returns an `Array` of path `String`s.
These paths will be used for asset logical path lookups.
Note that a copy of the `Array` is returned so mutating will have no affect on the environment. See `append_path`, `prepend_path`, and `clear_paths`.
# File lib/sprockets/trail.rb, line 23 23: def paths 24: trail.paths.dup 25: end
Prepend a `path` to the `paths` list.
Paths at the end of the `Array` have the least priority.
# File lib/sprockets/trail.rb, line 30 30: def prepend_path(path) 31: expire_index! 32: @trail.prepend_path(path) 33: end
Finds the expanded real path for a given logical path by searching the environment’s paths.
resolve("application.js") # => "/path/to/app/javascripts/application.js.coffee"
A `FileNotFound` exception is raised if the file does not exist.
# File lib/sprockets/trail.rb, line 70 70: def resolve(logical_path, options = {}) 71: # If a block is given, preform an iterable search 72: if block_given? 73: args = attributes_for(logical_path).search_paths + [options] 74: trail.find(*args) do |path| 75: yield Pathname.new(path) 76: end 77: else 78: resolve(logical_path, options) do |pathname| 79: return pathname 80: end 81: raise FileNotFound, "couldn't find file '#{logical_path}'" 82: end 83: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.