Skip to content

Commit

Permalink
186 bro :'(
Browse files Browse the repository at this point in the history
  • Loading branch information
raggi committed Oct 3, 2010
1 parent 511ee6f commit d3893c2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/rack/auth/digest/params.rb
Expand Up @@ -4,10 +4,10 @@ module Digest
class Params < Hash

def self.parse(str)
Params[split_header_value(str).map do |param|
Params[*split_header_value(str).map do |param|
k, v = param.split('=', 2)
[k, dequote(v)]
end]
end.flatten]
end

def self.dequote(str) # From WEBrick::HTTPUtils
Expand Down
8 changes: 4 additions & 4 deletions lib/rack/request.rb
Expand Up @@ -50,9 +50,9 @@ def media_type
# { 'charset' => 'utf-8' }
def media_type_params
return {} if content_type.nil?
Hash[content_type.split(/\s*[;,]\s*/)[1..-1].
Hash[*content_type.split(/\s*[;,]\s*/)[1..-1].
collect { |s| s.split('=', 2) }.
map { |k,v| [k.downcase, v] }]
map { |k,v| [k.downcase, v] }.flatten]
end

# The character set of the request body if a "charset" media type
Expand Down Expand Up @@ -212,9 +212,9 @@ def cookies
# precede those with less specific. Ordering with respect to other
# attributes (e.g., Domain) is unspecified.
@env["rack.request.cookie_hash"] =
Hash[Utils.parse_query(@env["rack.request.cookie_string"], ';,').map {|k,v|
Hash[*Utils.parse_query(@env["rack.request.cookie_string"], ';,').map {|k,v|
[k, Array === v ? v.first : v]
}]
}.flatten]
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/rack/utils.rb
Expand Up @@ -308,9 +308,9 @@ def each
end

def to_hash
Hash[map do |k, v|
Hash[*map do |k, v|
[k, v.respond_to?(:to_ary) ? v.to_ary.join("\n") : v]
end]
end.flatten]
end

def [](k)
Expand Down Expand Up @@ -418,9 +418,9 @@ def replace(other)
# Responses with HTTP status codes that should not have an entity body
STATUS_WITH_NO_ENTITY_BODY = Set.new((100..199).to_a << 204 << 304)

SYMBOL_TO_STATUS_CODE = Hash[HTTP_STATUS_CODES.map { |code, message|
SYMBOL_TO_STATUS_CODE = Hash[*HTTP_STATUS_CODES.map { |code, message|
[message.downcase.gsub(/\s|-/, '_').to_sym, code]
}]
}.flatten]

def status_code(status)
if status.is_a?(Symbol)
Expand Down

0 comments on commit d3893c2

Please sign in to comment.