File: error.rb

package info (click to toggle)
ruby-mime 0.4.4-2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 284 kB
  • sloc: ruby: 1,187; xml: 17; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 716 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module MIME

  #
  # General purpose MIME errors.
  #
  class Error < StandardError ; end

  #
  # Undetectable MIME content type error.
  #
  class UnknownContentError < Error ; end

  #
  # Abstract class object initialization error. Many classes in the MIME
  # library are abstract and will raise this error.
  #
  class AbstractClassError < Error

    #
    # A helper method for detecting the intialization of an object in an
    # abstract class. +myself+ must always be *self* and +klass+ is the
    # abstract class object.
    #
    def self.no_instantiation myself, klass
      if myself.class == klass
        raise AbstractClassError.new('cannot construct abstract class')
      end
    end

  end

end