From abc1e5831cae724cfcdf524f62abb71be02d7e86 Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Tue, 3 Dec 2013 02:41:26 -0500 Subject: Convert Mime::NullType in a singleton --- actionpack/lib/action_dispatch/http/mime_type.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/http/mime_type.rb b/actionpack/lib/action_dispatch/http/mime_type.rb index c92d997a5c..a398919ca7 100644 --- a/actionpack/lib/action_dispatch/http/mime_type.rb +++ b/actionpack/lib/action_dispatch/http/mime_type.rb @@ -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 -- cgit v1.2.3