Class: LLM::Mime
- Inherits:
-
Object
- Object
- LLM::Mime
- Defined in:
- lib/llm/mime.rb
Class Method Summary collapse
-
.[](key) ⇒ String?
Lookup a mime type.
-
.types ⇒ Hash
Returns a Hash of mime types.
Class Method Details
.[](key) ⇒ String?
Lookup a mime type
9 10 11 12 13 14 15 |
# File 'lib/llm/mime.rb', line 9 def self.[](key) if key.respond_to?(:path) types[File.extname(key.path)] else types[key] end end |
.types ⇒ Hash
Returns a Hash of mime types
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/llm/mime.rb', line 20 def self.types @types ||= { # Images ".png" => "image/png", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".webp" => "image/webp", # Videos ".flv" => "video/x-flv", ".mov" => "video/quicktime", ".mpeg" => "video/mpeg", ".mpg" => "video/mpeg", ".mp4" => "video/mp4", ".webm" => "video/webm", ".wmv" => "video/x-ms-wmv", ".3gp" => "video/3gpp", # Audio ".aac" => "audio/aac", ".flac" => "audio/flac", ".mp3" => "audio/mpeg", ".m4a" => "audio/mp4", ".mpga" => "audio/mpeg", ".opus" => "audio/opus", ".pcm" => "audio/L16", ".wav" => "audio/wav", ".weba" => "audio/webm", # Documents ".pdf" => "application/pdf", ".txt" => "text/plain" } end |