Class: Locomotive::Steam::ThemeAssetUrlService
- Inherits:
-
Object
- Object
- Locomotive::Steam::ThemeAssetUrlService
- Defined in:
- lib/locomotive/steam/services/theme_asset_url_service.rb
Instance Method Summary collapse
Instance Method Details
#build(path) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/locomotive/steam/services/theme_asset_url_service.rb', line 8 def build(path) # keep the query string safe path.gsub!(/(\?+.+)$/, '') query_string = $1 # build the url of the theme asset based on the persistence layer _url = repository.url_for(path) # get a timestamp only if the source url doesn't include a query string = query_string.blank? ? checksums[path] : nil # prefix by a asset host if given url = asset_host ? asset_host.compute(_url, ) : _url query_string ? "#{url}#{query_string}" : url end |
#checksum? ⇒ Boolean
33 34 35 |
# File 'lib/locomotive/steam/services/theme_asset_url_service.rb', line 33 def checksum? !!checksum end |
#checksums ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/locomotive/steam/services/theme_asset_url_service.rb', line 25 def checksums if checksum? @checksums ||= fetch_checksums else {} end end |