Skip to content
This repository
Browse code

Convert Mime::NullType in a singleton

Conflicts:
	actionpack/lib/action_dispatch/http/mime_type.rb
  • Loading branch information...
commit ae3e6136ed944f653a21527e3a48c086cb74540a 1 parent 4fdc156
Guillermo Iguaran authored
5  actionpack/lib/action_dispatch/http/mime_type.rb
... ...
@@ -1,4 +1,5 @@
1 1
 require 'set'
  2
+require 'singleton'
2 3
 require 'active_support/core_ext/class/attribute_accessors'
3 4
 require 'active_support/core_ext/string/starts_ends_with'
4 5
 
@@ -27,7 +28,7 @@ def #{method}(*)
27 28
   class << self
28 29
     def [](type)
29 30
       return type if type.is_a?(Type)
30  
-      Type.lookup_by_extension(type) || NullType.new
  31
+      Type.lookup_by_extension(type) || NullType.instance
31 32
     end
32 33
 
33 34
     def fetch(type)
@@ -308,6 +309,8 @@ def respond_to_missing?(method, include_private = false) #:nodoc:
308 309
   end
309 310
 
310 311
   class NullType
  312
+    include Singleton
  313
+
311 314
     def nil?
312 315
       true
313 316
     end

0 notes on commit ae3e613

Please sign in to comment.
Something went wrong with that request. Please try again.