aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-09-21 11:03:32 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-09-21 12:04:12 -0700
commitad1d0b8408f08bc08d54adfd66040bea14b44fe4 (patch)
tree76c61a6b236c996238ffe6641513278c453df42f /actionpack
parent5db723327d75a4b77ba49f0fa4b4b29cd1e04402 (diff)
downloadrails-ad1d0b8408f08bc08d54adfd66040bea14b44fe4.tar.gz
rails-ad1d0b8408f08bc08d54adfd66040bea14b44fe4.tar.bz2
rails-ad1d0b8408f08bc08d54adfd66040bea14b44fe4.zip
cache the new type object on the stack
Now we don't have to look it up with a `const_get`.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/http/mime_type.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/mime_type.rb b/actionpack/lib/action_dispatch/http/mime_type.rb
index a639f8a8f8..ba6cf809ca 100644
--- a/actionpack/lib/action_dispatch/http/mime_type.rb
+++ b/actionpack/lib/action_dispatch/http/mime_type.rb
@@ -160,9 +160,9 @@ module Mime
end
def register(string, symbol, mime_type_synonyms = [], extension_synonyms = [], skip_lookup = false)
- Mime.const_set(symbol.upcase, Type.new(string, symbol, mime_type_synonyms))
+ new_mime = Type.new(string, symbol, mime_type_synonyms)
+ Mime.const_set(symbol.upcase, new_mime)
- new_mime = Mime.const_get(symbol.upcase)
SET << new_mime
([string] + mime_type_synonyms).each { |str| LOOKUP[str] = SET.last } unless skip_lookup