Sha256: 020ee7ae315635cd202adf64e716a8c129250cd01d3ec23e6ce5a9f08ecb2565
Contents?: true
Size: 571 Bytes
Versions: 6
Compression:
Stored size: 571 Bytes
Contents
begin require 'mimetype_fu' rescue MissingSourceFile end module Milton class File < ::File class << self def extension(filename) extension = extname(filename) extension.slice(1, extension.length-1) end # File respond_to?(:mime_type) is true if mimetype_fu is installed, so # this way we always have File.mime_type? available but it favors # mimetype_fu's implementation. def mime_type?(file) ::File.respond_to?(:mime_type?) ? super(file.filename) : file.content_type end end end end
Version data entries
6 entries across 6 versions & 2 rubygems