aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2013-12-03 02:41:26 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2013-12-03 02:41:26 -0500
commitabc1e5831cae724cfcdf524f62abb71be02d7e86 (patch)
treeaeb7f9610825da5f98cd04bb8b3baac816431415 /actionpack/lib
parent66b1c2d3b5fbca53d0627a3332e6d3c25edc8b6b (diff)
downloadrails-abc1e5831cae724cfcdf524f62abb71be02d7e86.tar.gz
rails-abc1e5831cae724cfcdf524f62abb71be02d7e86.tar.bz2
rails-abc1e5831cae724cfcdf524f62abb71be02d7e86.zip
Convert Mime::NullType in a singleton
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/http/mime_type.rb5
1 files changed, 4 insertions, 1 deletions
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