Class: Jekyll::AssetsPlugin::AssetPath
- Inherits:
-
Object
- Object
- Jekyll::AssetsPlugin::AssetPath
- Defined in:
- lib/jekyll/assets_plugin/asset_path.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #cachebust ⇒ Object
-
#initialize(asset) ⇒ AssetPath
constructor
A new instance of AssetPath.
- #path ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(asset) ⇒ AssetPath
Returns a new instance of AssetPath.
6 7 8 9 |
# File 'lib/jekyll/assets_plugin/asset_path.rb', line 6 def initialize(asset) asset.bundle! @asset = asset end |
Instance Attribute Details
#anchor ⇒ Object
30 31 32 |
# File 'lib/jekyll/assets_plugin/asset_path.rb', line 30 def anchor "##{@anchor}" if @anchor end |
#query ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/jekyll/assets_plugin/asset_path.rb', line 19 def query query = [] query << "cb=#{@asset.digest}" if :soft == cachebust query << @query if @query return if query.empty? "?" << query.join("&") end |
Instance Method Details
#cachebust ⇒ Object
11 12 13 |
# File 'lib/jekyll/assets_plugin/asset_path.rb', line 11 def cachebust @cachebust ||= @asset.site.assets_config.cachebust end |
#path ⇒ Object
15 16 17 |
# File 'lib/jekyll/assets_plugin/asset_path.rb', line 15 def path :hard == cachebust && @asset.digest_path || @asset.logical_path end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/jekyll/assets_plugin/asset_path.rb', line 34 def to_s "#{@asset.site.assets_config.baseurl}/#{path}#{query}#{anchor}" end |