Class: Jekyll::Assets::Drop
- Inherits:
-
Liquid::Drop
- Object
- Liquid::Drop
- Jekyll::Assets::Drop
- Extended by:
- Forwardable::Extended
- Defined in:
- lib/jekyll/assets/drop.rb
Instance Method Summary collapse
-
#digest_path ⇒ String
– The digest path.
-
#dimensions ⇒ Hash<Integer,Integer>
– Image dimensions if the asest is an image.
-
#initialize(path, jekyll:) ⇒ Drop
constructor
A new instance of Drop.
Constructor Details
#initialize(path, jekyll:) ⇒ Drop
Returns a new instance of Drop.
13 14 15 16 17 18 |
# File 'lib/jekyll/assets/drop.rb', line 13 def initialize(path, jekyll:) @path = path.to_s @sprockets = jekyll.sprockets @jekyll = jekyll @asset = nil end |
Instance Method Details
#digest_path ⇒ String
TODO:
this needs to move to ‘_url`
– The digest path. –
32 33 34 |
# File 'lib/jekyll/assets/drop.rb', line 32 def digest_path @sprockets.prefix_url(asset.digest_path) end |
#dimensions ⇒ Hash<Integer,Integer>
Note:
this can break easily.
– Image dimensions if the asest is an image. –
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/jekyll/assets/drop.rb', line 41 def dimensions @dimensions ||= begin img = FastImage.size(asset.filename.to_s) { "width" => img[0], "height" => img[1], } rescue => e Logger.error e end end |