Class: Editable
- Inherits:
-
Object
- Object
- Editable
- Defined in:
- lib/editable.rb
Class Method Summary collapse
Class Method Details
.mime_for(name) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/editable.rb', line 2 def self.mime_for(name) case name.to_s when /\.(png|gif|jpg|jpeg)\Z/ "image" when /\.css\Z/ "text/css" when /\.js\Z/ "text/javascript" when /\.xml\Z/ "application/xml" when /\.yml\Z/ "text/x-yaml" when /\.json\Z/ "application/json" when /\.txt\Z/ "text/plain" when /\.liquid\Z/ "liquid" when /\.(html|htm|xhtml)\Z/ "text/html" else "unknown_type" end end |