class RMail::Header

Public Instance Methods

content_type(default = nil) { || ... } click to toggle source

This returns the full content type of this message converted to lower case.

If there is no content type header, returns the passed block is executed and its return value is returned. If no block is passed, the value of the default argument is returned.

# File lib/sup/util.rb, line 151
def content_type(default = nil)
  if value = self['content-type'] and ct = value.strip.split(/\s*;\s*/)[0]
    return ct.downcase
  else
    if block_given?
      yield
    else
      default
    end
  end
end