Module: Padrino::Mailer::Mime
- Defined in:
- padrino-mailer/lib/padrino-mailer/mime.rb
Overview
Handles MIME type declarations for mail delivery.
Constant Summary collapse
- MIME_TYPES =
{ "text/html" => :html, "text/plain" => :plain, "text/xml" => :xml }
Class Method Summary collapse
-
.mime_type(mime, fallback = :plain) ⇒ Object
Returns Symbol with mime type if found, otherwise use
fallback
.
Class Method Details
.mime_type(mime, fallback = :plain) ⇒ Object
Returns Symbol with mime type if found, otherwise use fallback
. mime
should be the content type like “text/plain” fallback
may be any symbol.
Also see the documentation for MIME_TYPES.
This is a shortcut for:
Padrino::Mailer::Mime::MIME_TYPES.fetch('text/plain', :plain)
29 30 31 |
# File 'padrino-mailer/lib/padrino-mailer/mime.rb', line 29 def self.mime_type(mime, fallback=:plain) MIME_TYPES.fetch(mime.to_s.split(';').first.to_s.downcase, fallback) end |