Skip to content
This repository
Browse code

remove select, collect and then inject with

something better

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
commit 794b34306eea0c7e1e99f5741df16129e8e22b3f 1 parent c5bfc6a
Neeraj Singh authored November 22, 2010 josevalim committed November 22, 2010
2  actionpack/lib/action_dispatch/http/mime_type.rb
@@ -175,7 +175,7 @@ def parse(accept_header)
175 175
       # returend value: [Mime::HTML, Mime::JS, Mime::XML, Mime::YAML, Mime::ATOM, Mime::JSON, Mime::RSS, Mime::URL_ENCODED_FORM
176 176
       def parse_data_with_trailing_star(input)
177 177
         keys = Mime::LOOKUP.keys.select{|k| k.include?(input)}
178  
-        Mime::LOOKUP.select {|k,_| keys.include?(k)}.collect{|i| i[1]}.inject([]){|all,e| all.include?(e) ? all : all << e}
  178
+        Mime::LOOKUP.values_at(*keys).uniq
179 179
       end
180 180
     end
181 181
 

0 notes on commit 794b343

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