instance method main_type

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

main_type( default = nil )

Returns the current main type of the “Content-Type” of the mail instance.

If the content_type field does not exist, returns nil by default or you can pass in as the parameter for what you want the default value to be.

Example:

mail = TMail::Mail.new
mail.main_type #=> nil
mail.main_type([]) #=> []
mail = TMail::Mail.load("../test/fixtures/raw_email")
mail.main_type #=> "text"

Parameters

default opt = nil
Source
# File actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/interface.rb, line 767
    def main_type( default = nil )
      if h = @header['content-type']
        h.main_type || default
      else
        default
      end
    end

Defined in actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/interface.rb line 767 · View on GitHub · Improve this page · Find usages on GitHub

Defined in TMail::Mail

Type at least 2 characters to search.

↑↓ navigate · open · esc close