Skip to content
Browse files

Refactored Rack::Request#media_type

No need for subscript, first reads better

Signed-off-by: Christian Neukirchen <chneukirchen@gmail.com>
  • Loading branch information...
1 parent aa567e2 commit 939fa7d24c8086ad3b9799704a32a2e30d6fbd4e @tj tj committed with chneukirchen Mar 18, 2009
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/rack/request.rb
View
2 lib/rack/request.rb
@@ -46,7 +46,7 @@ def content_type; @env['CONTENT_TYPE'] end
# For more information on the use of media types in HTTP, see:
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7
def media_type
- content_type && content_type.split(/\s*[;,]\s*/, 2)[0].downcase
+ content_type && content_type.split(/\s*[;,]\s*/, 2).first.downcase
end
# The media type parameters provided in CONTENT_TYPE as a Hash, or

0 comments on commit 939fa7d

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