| Class | Juicer::Asset::PathResolver |
| In: |
lib/juicer/asset/path_resolver.rb
|
| Parent: | Object |
Factory class that creates Juicer::Asset::Path objects from a common set of options. Also facilitates asset host cycling on a set of asset paths.
path_resolver = Juicer::Asset::PathResolver.new(
:document_root => "/var/www",
:hosts => ["assets1.mysite.com", "assets2.mysite.com"]
)
asset = path_resolver.resolve("../images/logo.png")
asset.document_root
#=> "/var/www"
asset.absolute_path(path_resolver.cycle_hosts)
#=> "http://assets1.mysite.com/images/logo.png"
asset = path_resolver.resolve("/favicon.ico")
asset.absolute_path(path_resolver.cycle_hosts)
#=> "http://assets2.mysite.com/favicon.ico"
| Author: | Christian Johansen (christian@cjohansen.no) |
| Copyright: | Copyright (c) 2009 Christian Johansen |
| License: | BSD |
| base | [R] | |
| document_root | [R] | |
| hosts | [R] |
Set new base directory. Will affect any assets resolved from here, but any assets previously resolved will not be changed
Returns a Juicer::Asset::Path object for the given path, and the options set on the resolver.