jekyll-responsive-image/lib/jekyll/responsive_image/utils.rb

26 lines
607 B
Ruby
Raw Normal View History

module Jekyll
class ResponsiveImage
module Utils
def symbolize_keys(hash)
result = {}
hash.each_key do |key|
result[key.to_sym] = hash[key]
end
result
end
2014-12-08 00:06:28 +11:00
# Build a hash containing image information
def image_hash(path, width, height)
2014-12-08 00:06:28 +11:00
{
'path' => path,
'basename' => File.basename(path),
'filename' => File.basename(path, '.*'),
'extension' => File.extname(path).delete('.'),
'width' => width,
'height' => height,
}
end
end
end
end