Permalink
Browse files

Use more distinct and faster form of Hash casting

  • Loading branch information...
1 parent 4c58e4d commit cbe9d572b508afd4d3eadfd007aab48127b05501 @brainopia brainopia committed Jan 27, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/rack/handler/mongrel.rb
  2. +1 −1 lib/rack/handler/scgi.rb
  3. +1 −1 lib/rack/session/abstract/id.rb
@@ -53,7 +53,7 @@ def initialize(app)
end
def process(request, response)
- env = {}.replace(request.params)
+ env = Hash[request.params]
env.delete "HTTP_CONTENT_TYPE"
env.delete "HTTP_CONTENT_LENGTH"
View
@@ -29,7 +29,7 @@ def initialize(settings = {})
end
def process_request(request, input_body, socket)
- env = {}.replace(request)
+ env = Hash[request]
env.delete "HTTP_CONTENT_TYPE"
env.delete "HTTP_CONTENT_LENGTH"
env["REQUEST_PATH"], env["QUERY_STRING"] = env["REQUEST_URI"].split('?', 2)
@@ -79,7 +79,7 @@ def clear
def to_hash
load_for_read!
- h = {}.replace(self)
+ h = Hash[self]
h.delete_if { |k,v| v.nil? }
h
end

0 comments on commit cbe9d57

Please sign in to comment.