aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-09-29 15:41:06 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-09-29 15:41:06 -0700
commit3f88f26d1e17277dfa85a22bb01c1db558b6addf (patch)
tree5be229453787c71544fc9e4c2b38c64fb09fafc3 /actionpack/lib
parent2437356cdacf2b774147b4da38de1d137e0a8b26 (diff)
downloadrails-3f88f26d1e17277dfa85a22bb01c1db558b6addf.tar.gz
rails-3f88f26d1e17277dfa85a22bb01c1db558b6addf.tar.bz2
rails-3f88f26d1e17277dfa85a22bb01c1db558b6addf.zip
removing more lolinject
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/metal/http_authentication.rb15
1 files changed, 7 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/metal/http_authentication.rb b/actionpack/lib/action_controller/metal/http_authentication.rb
index 53444f31a8..e0c5eaca84 100644
--- a/actionpack/lib/action_controller/metal/http_authentication.rb
+++ b/actionpack/lib/action_controller/metal/http_authentication.rb
@@ -423,14 +423,13 @@ module ActionController
# Returns nil if no token is found.
def token_and_options(request)
if header = request.authorization.to_s[/^Token (.*)/]
- values = $1.split(',').
- inject({}) do |memo, value|
- value.strip! # remove any spaces between commas and values
- key, value = value.split(/\=\"?/) # split key=value pairs
- value.chomp!('"') # chomp trailing " in value
- value.gsub!(/\\\"/, '"') # unescape remaining quotes
- memo.update(key => value)
- end
+ values = Hash[$1.split(',').map do |value|
+ value.strip! # remove any spaces between commas and values
+ key, value = value.split(/\=\"?/) # split key=value pairs
+ value.chomp!('"') # chomp trailing " in value
+ value.gsub!(/\\\"/, '"') # unescape remaining quotes
+ [key, value]
+ end]
[values.delete("token"), values.with_indifferent_access]
end
end