Sha256: 93ad89491a3bd4d9159cff74c06dc5f6166d8f31e33974a13d6cb112e50e4954

Contents?: true

Size: 534 Bytes

Versions: 1

Compression:

Stored size: 534 Bytes

Contents

module Hanko
  module AssetUrlHelper
    URI_REGEXP = %r{^(?:[-a-z]+://|cid:|data:|//)}i

    def asset_path(source, options = {})
      @_hanko_has_tail = source.match?(/[\?#]/)
      super
    end
    alias_method :path_to_asset, :asset_path

    def compute_asset_path(source, options = {})
      source = super
      return source if @_hanko_has_tail

      asset_id = Hanko::Fingerprint.pon(config.assets_dir, source)
      if asset_id.empty?
        source
      else
        "#{source}?#{asset_id}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hanko-0.2.3 lib/hanko/asset_url_helper.rb