Module: MIME

Defined in:
lib/mime.rb

Overview

The namespace for MIME applications, tools, and libraries.

Defined Under Namespace

Classes: Type, Types

Class Method Summary collapse

Class Method Details

.const_missing(name) ⇒ Object

MIME::InvalidContentType was moved to MIME::Type::InvalidContentType. Provide a single warning about this fact in the interim.


34
35
36
37
38
39
40
41
42
# File 'lib/mime.rb', line 34

def const_missing(name) # :nodoc:
  case name.to_s
  when "InvalidContentType"
    warn_about_moved_constants(name)
    MIME::Type.const_get(name.to_sym)
  else
    super
  end
end

.deprecated(klass, sym, message = nil, &block) ⇒ Object

Used to mark a method as deprecated in the mime-types interface.


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/mime.rb', line 9

def deprecated(klass, sym, message = nil, &block) # :nodoc:
  level = case klass
          when Class, Module
            '.'
          else
            klass = klass.class
            '#'
          end
  unless defined?(@__deprecated) and @__deprecated["#{klass}#{level}#{sym}"]
    message = case message
              when :private, :protected
                "and will be #{message}"
              when nil
                "and will be removed"
              else
                message
              end
    warn "#{klass}#{level}#{sym} is deprecated #{message}."
    (@__deprecated ||= {})["#{klass}#{level}#{sym}"] = true
    block.call if block
  end
end