class Yokunai::Mime
Provides a light wrapper around MimeMagic to make it a little easier to use.
Public Class Methods
detect_from_path(path, fallback = "text/plain")
click to toggle source
Detect the mime type from the given path string.
@param path [String] the path @return [String] the mime type string
# File lib/yokunai/mime.rb, line 9 def self.detect_from_path(path, fallback = "text/plain") mime = MimeMagic.by_path(path) mime ? mime.type : fallback end