Sha256: db126a8fa5dc3d8416e249c449b2fcec6a0c87db813940271e859caa94177223

Contents?: true

Size: 1.13 KB

Versions: 21

Compression:

Stored size: 1.13 KB

Contents

module Padrino
  module Mailer
    module Mime

      ##
      # 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
      #
      # ==== Examples
      #
      #   => :plain
      #   Padrino::Mailer::Mime.mime_type('text/plain')
      #   => :html
      #   Padrino::Mailer::Mime.mime_type('text/html')
      #
      # This is a shortcut for:
      #
      #   Padrino::Mailer::Mime::MIME_TYPES.fetch('text/plain', :plain)
      #
      def self.mime_type(mime, fallback=:plain)
        MIME_TYPES.fetch(mime.to_s.downcase, fallback)
      end

      # List of most common mime-types, selected various sources
      # according to their usefulness in a emailg scope for Ruby
      # users.
      #
      # You can add your own mime types like:
      #
      #   Padrino::Mailer::MIME_TYPES.merge!("text/xml" => :xml)
      #
      MIME_TYPES = {
        "text/html"  => :html,
        "text/plain" => :plain,
        "text/xml"   => :xml
      }
    end # Mime
  end # Mailer
end # Padrino

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
padrino-mailer-0.10.1 lib/padrino-mailer/mime.rb
padrino-mailer-0.10.0 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.29 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.28 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.27 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.26 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.24 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.25 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.23 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.22 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.21 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.20 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.19 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.18 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.17 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.16 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.15 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.14 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.13 lib/padrino-mailer/mime.rb
padrino-mailer-0.9.12 lib/padrino-mailer/mime.rb