lib/rack/utils.rb in rack-1.3.0 vs lib/rack/utils.rb in rack-1.3.1
- old
+ new
@@ -1,14 +1,14 @@
# -*- encoding: binary -*-
-
require 'fileutils'
require 'set'
require 'tempfile'
-
require 'rack/multipart'
-if RUBY_VERSION[/^\d+\.\d+/] == '1.8'
+major, minor, patch = RUBY_VERSION.split('.').map { |v| v.to_i }
+
+if (major == 1 && minor < 9) || (major == 1 && minor == 9 && patch < 2)
# pull in backports
require 'rack/backports/uri/common'
else
require 'uri/common'
end
@@ -349,12 +349,12 @@
yield(k, v.respond_to?(:to_ary) ? v.to_ary.join("\n") : v)
end
end
def to_hash
- Hash[*map do |k, v|
- [k, v.respond_to?(:to_ary) ? v.to_ary.join("\n") : v]
- end.flatten]
+ hash = {}
+ each { |k,v| hash[k] = v }
+ hash
end
def [](k)
super(k) || super(@names[k.downcase])
end