Class: AssetHostSelection::AssetHostname
- Inherits:
-
Object
- Object
- AssetHostSelection::AssetHostname
- Defined in:
- lib/asset_host_selection.rb
Instance Method Summary collapse
- #call(source, request) ⇒ Object
-
#initialize(selector) ⇒ AssetHostname
constructor
A new instance of AssetHostname.
Constructor Details
#initialize(selector) ⇒ AssetHostname
Returns a new instance of AssetHostname.
46 47 48 |
# File 'lib/asset_host_selection.rb', line 46 def initialize(selector) @selector = selector end |
Instance Method Details
#call(source, request) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/asset_host_selection.rb', line 50 def call(source, request) asset_provider = @selector.select(request) host = asset_provider.host if asset_provider if host.nil? # Relative URL. Useful in dev where no CDNs are configured nil else "http#{"s" if request.ssl?}://#{host}" end end |