mime_type(filename, mime_tab)
private
Returns the mime type of filename from the list in
mime_tab. If no mime type was found application/octet-stream is
returned.
Show source
def mime_type(filename, mime_tab)
suffix1 = (/\.(\w+)$/ =~ filename && $1.downcase)
suffix2 = (/\.(\w+)\.[\w\-]+$/ =~ filename && $1.downcase)
mime_tab[suffix1] || mime_tab[suffix2] || "application/octet-stream"
end