class Jekyll::Assets::Drop
Public Class Methods
new(path, jekyll:)
click to toggle source
# File lib/jekyll/assets/drop.rb, line 13 def initialize(path, jekyll:) @path = path.to_s @sprockets = jekyll.sprockets @jekyll = jekyll @asset = nil end
Public Instance Methods
digest_path()
click to toggle source
– @todo this needs to move to `_url` @return [String] the prefixed and digested path. The digest path. –
# File lib/jekyll/assets/drop.rb, line 32 def digest_path @sprockets.prefix_url(asset.digest_path) end
dimensions()
click to toggle source
– Image dimensions if the asest is an image. @return [Hash<Integer,Integer>] the dimensions. @note this can break easily. –
# 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
Private Instance Methods
asset()
click to toggle source
# File lib/jekyll/assets/drop.rb, line 55 def asset @asset ||= begin @sprockets.find_asset!(@path) end end