Class: TpCommon::AssetLoaders::PackagePathProviders::Production

Inherits:
Object
  • Object
show all
Defined in:
lib/tp_common/asset_loaders/package_path_providers/production.rb

Direct Known Subclasses

Development

Instance Method Summary collapse

Constructor Details

#initialize(default_cdn, _dev_cdn = nil) ⇒ Production

Returns a new instance of Production.


5
6
7
8
9
10
11
12
# File 'lib/tp_common/asset_loaders/package_path_providers/production.rb', line 5

def initialize(default_cdn, _dev_cdn = nil)
  @default_cdn = default_cdn
  @dev_cdn = _dev_cdn

  @cache = Hash.new do |current_hash, key|
    current_hash[key] = key.to_s.split('.').insert(-2, 'min').join('.')
  end
end

Instance Method Details

#asset_url(package_name, version, asset) ⇒ Object


14
15
16
# File 'lib/tp_common/asset_loaders/package_path_providers/production.rb', line 14

def asset_url(package_name, version, asset)
  @cache[key(package_name, version, asset)]
end