Created
March 17, 2009 07:16
-
-
Save deepthawtz/80381 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Register the default MIME types: | |
| # | |
| # By default, the mime-types include: | |
| # :all:: no transform, */* | |
| # :yaml:: to_yaml, application/x-yaml or text/yaml | |
| # :text:: to_text, text/plain | |
| # :html:: to_html, text/html or application/xhtml+xml or application/html | |
| # :xml:: to_xml, application/xml or text/xml or application/x-xml | |
| # :js:: to_json, text/javascript ot application/javascript or application/x-javascript | |
| # :json:: to_json, application/json or text/x-json | |
| class Merb::BootLoader::MimeTypes < Merb::BootLoader | |
| # Registers the default MIME types. | |
| # | |
| # ==== Returns | |
| # nil | |
| # | |
| # :api: plugin | |
| def self.run | |
| Merb.add_mime_type(:all, nil, %w[*/*]) | |
| Merb.add_mime_type(:yaml, :to_yaml, %w[application/x-yaml text/yaml], :charset => "utf-8") | |
| Merb.add_mime_type(:text, :to_text, %w[text/plain], :charset => "utf-8") | |
| Merb.add_mime_type(:html, :to_html, %w[text/html application/xhtml+xml application/html], :charset => "utf-8") | |
| Merb.add_mime_type(:xml, :to_xml, %w[application/xml text/xml application/x-xml], {:charset => "utf-8"}, 0.9998) | |
| Merb.add_mime_type(:js, :to_json, %w[text/javascript application/javascript application/x-javascript], :charset => "utf-8") | |
| Merb.add_mime_type(:json, :to_json, %w[application/json text/x-json], :charset => "utf-8") | |
| nil | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment