class Sinatra::Base

def provides(*types)

Condition for matching mimetypes. Accepts file extensions.
def provides(*types)
  types.map! { |t| mime_type(t) }
  condition do
    matching_types = (request.accept & types)
    unless matching_types.empty?
      content_type matching_types.first
      true
    else
      false
    end
  end
end