Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
cache the new type object on the stack
Now we don't have to look it up with a `const_get`.
  • Loading branch information
tenderlove committed Sep 21, 2015
1 parent 5db7233 commit ad1d0b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_dispatch/http/mime_type.rb
Expand Up @@ -160,9 +160,9 @@ def register_alias(string, symbol, extension_synonyms = [])
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
Expand Down

0 comments on commit ad1d0b8

Please sign in to comment.