# File lib/sinatra/respond_with.rb, line 106 def finish yield self if block_given? mime_type = @app.content_type || @app.request.preferred_type(@map.keys) || @app.request.preferred_type || 'text/html' type = mime_type.split(/\s*;\s*/, 2).first handlers = [@map[type], @generic[type[/^[^\/]+/]], @default].compact handlers.each do |block| if result = block.call(type) @app.content_type mime_type @app.halt result end end @app.halt 406 end