Module: Mime
- Defined in:
- lib/rad/_support/mime.rb
Class Method Summary collapse
Class Method Details
.[](type) ⇒ Object
8 9 10 11 |
# File 'lib/rad/_support/mime.rb', line 8 def [] type type = ".#{type}" unless type =~ /^\./ Rack::Mime.mime_type(type) || raise("Unknown MIME type: #{type}") end |
.image?(file_name) ⇒ Boolean
13 14 15 16 17 |
# File 'lib/rad/_support/mime.rb', line 13 def image? file_name return false if file_name.blank? extension = File.extname(file_name) Rack::Mime.mime_type(extension) =~ /image/ end |
.method_missing(m, *args) ⇒ Object
3 4 5 6 |
# File 'lib/rad/_support/mime.rb', line 3 def method_missing m, *args raise "invalid usage of Mime!" unless args.empty? self[m] end |