Convert Mime::NullType in a singleton

This commit is contained in:
Guillermo Iguaran 2013-12-03 02:41:26 -05:00
parent 66b1c2d3b5
commit abc1e5831c
1 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,5 @@
require 'set'
require 'singleton'
require 'active_support/core_ext/module/attribute_accessors'
require 'active_support/core_ext/string/starts_ends_with'
@ -27,7 +28,7 @@ module Mime
class << self
def [](type)
return type if type.is_a?(Type)
Type.lookup_by_extension(type) || NullType.new
Type.lookup_by_extension(type) || NullType.instance
end
def fetch(type)
@ -292,6 +293,8 @@ module Mime
end
class NullType
include Singleton
def nil?
true
end