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

26 lines
616 B
Ruby
Raw Normal View History

module Jekyll
class ResponsiveImage
class Utils
def self.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 self.image_hash(path, width, height)
{
'path' => path,
'basename' => File.basename(path),
'filename' => File.basename(path, '.*'),
'extension' => File.extname(path).delete('.'),
'width' => width,
'height' => height,
}
end
end
end
end