Module: Mime
- Defined in:
- lib/fresco/runtime/runtime.rb
Constant Summary collapse
- EXT_MAP =
{ ".html" => "text/html; charset=utf-8", ".htm" => "text/html; charset=utf-8", ".css" => "text/css; charset=utf-8", ".js" => "application/javascript", ".json" => "application/json", ".txt" => "text/plain; charset=utf-8", ".md" => "text/markdown; charset=utf-8", ".png" => "image/png", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".gif" => "image/gif", ".svg" => "image/svg+xml", ".ico" => "image/x-icon", ".wasm" => "application/wasm", }.freeze
Class Method Summary collapse
Class Method Details
.for_path(path = "") ⇒ Object
980 981 982 983 984 985 986 |
# File 'lib/fresco/runtime/runtime.rb', line 980 def self.for_path(path = "") dot = str_ridx(path, ".") return "application/octet-stream" if dot < 0 ext = path[dot...path.length].downcase return EXT_MAP[ext] if EXT_MAP.key?(ext) "application/octet-stream" end |