Method: Sinatra::Base.mime_types

Defined in:
lib/sinatra/base.rb

.mime_types(type) ⇒ Object

provides all mime types matching type, including deprecated types: mime_types :html # => ['text/html'] mime_types :js # => ['application/javascript', 'text/javascript']



1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
# File 'lib/sinatra/base.rb', line 1474

def mime_types(type)
  type = mime_type type
  if type =~ %r{^application/(xml|javascript)$}
    [type, "text/#{$1}"]
  elsif type =~ %r{^text/(xml|javascript)$}
    [type, "application/#{$1}"]
  else
    [type]
  end
end