module Mojito::Rendering::ContentTypes

Public Instance Methods

content_type(type = :html, charset = 'UTF-8') click to toggle source
# File lib/mojito/rendering/content_types.rb, line 8
def content_type(type = :html, charset = 'UTF-8')
        t = case type
        when :plain
                MIME::Types.type_for 'txt'
        else
                MIME::Types.type_for type.to_s
        end.first
        response['Content-Type'] = t.to_s + (t.ascii? ? "; charset=#{charset}" : '')
end