Sha256: 2be8b7c815244be7542802dd07240e10cdccecf8ade3f3ba35524aecde84157c
Contents?: true
Size: 846 Bytes
Versions: 2
Compression:
Stored size: 846 Bytes
Contents
module Sprockets module Helpers # `AssetPath` generates a full path for an asset # that exists in Sprockets environment. class AssetPath < FilePath # def initialize(asset, options = {}) @options = { :body => false, :digest => Helpers.digest, :prefix => Helpers.prefix }.merge options @source = @options[:digest] ? asset.digest_path : asset.logical_path end protected # Prepends the base path if the path is not # already an absolute path. def rewrite_base_path(path) # :nodoc: File.join @options[:prefix], path end # Rewrite the query string to inlcude body flag if necessary. def rewrite_query(path) options[:body] ? "#{path}?body=1" : path end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sprockets-helpers-0.2.0 | lib/sprockets/helpers/asset_path.rb |
sprockets-helpers-0.1.0 | lib/sprockets/helpers/asset_path.rb |