lib/http/accept/quoted_string.rb in http-accept-1.1.3 vs lib/http/accept/quoted_string.rb in http-accept-1.2.0

- old
+ new

@@ -37,8 +37,17 @@ value.gsub!(/[\r\n]+\s+/, ' ') end return value end + + # Quote a string if required. Doesn't handle newlines correctly currently. + def self.quote(value, force = false) + if value =~ /"/ or force + "\"#{value.gsub(/["\\]/, "\\\\\\0")}\"" + else + return value + end + end end end end