mirror of https://github.com/rails/rails
Convert Mime::NullType in a singleton
This commit is contained in:
parent
66b1c2d3b5
commit
abc1e5831c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue