Class: Locomotive::Liquid::AssetHost
- Inherits:
-
Object
- Object
- Locomotive::Liquid::AssetHost
- Defined in:
- lib/locomotive/liquid/asset_host.rb
Constant Summary collapse
- IsHTTP =
/^https?\/\//o
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
- #compute(source, timestamp = nil) ⇒ Object
-
#initialize(request, site, host) ⇒ AssetHost
constructor
A new instance of AssetHost.
Constructor Details
#initialize(request, site, host) ⇒ AssetHost
Returns a new instance of AssetHost.
10 11 12 13 14 |
# File 'lib/locomotive/liquid/asset_host.rb', line 10 def initialize(request, site, host) @request, @site = request, site @host = build_host(host, request, site) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
8 9 10 |
# File 'lib/locomotive/liquid/asset_host.rb', line 8 def host @host end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
8 9 10 |
# File 'lib/locomotive/liquid/asset_host.rb', line 8 def request @request end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
8 9 10 |
# File 'lib/locomotive/liquid/asset_host.rb', line 8 def site @site end |
Instance Method Details
#compute(source, timestamp = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/locomotive/liquid/asset_host.rb', line 16 def compute(source, = nil) return source if source.nil? return (source, ) if source =~ IsHTTP url = self.host ? URI.join(host, source).to_s : source (url, ) end |