Sha256: 52ca20f88693ac937c007ab5fa7bac281e5ce30e3b5cc9f5b7cc8c92d50019b9
Contents?: true
Size: 800 Bytes
Versions: 5
Compression:
Stored size: 800 Bytes
Contents
module Sinatra module AssetPack module HtmlHelpers extend self def e(str) re = Rack::Utils.escape_html str re = re.gsub("/", '/') # Rack sometimes insists on munging slashes in Ruby 1.8. re end def kv(hash) hash.map { |k, v| " #{e k}='#{e v}'" }.join('') end def get_file_uri(file, assets) raise RuntimeError, "You must pass in an asset for a URI to be created for it." if file.nil? local = assets.local_file_for file if assets.asset_hosts.nil? BusterHelpers.add_cache_buster(file, local) else assets.asset_hosts[Digest::MD5.hexdigest(file).to_i(16) % assets.asset_hosts.length]+BusterHelpers.add_cache_buster(file, local) end end end end end
Version data entries
5 entries across 5 versions & 2 rubygems