# File lib/rack/auth/digest/params.rb, line 13 def self.dequote(str) # From WEBrick::HTTPUtils ret = (%r\A"(.*)"\Z/ =~ str) ? $1 : str.dup ret.gsub!(%r\\(.)/, "\\1") ret end
# File lib/rack/auth/digest/params.rb, line 23 def initialize super() yield self if block_given? end
# File lib/rack/auth/digest/params.rb, line 6 def self.parse(str) Params[*split_header_value(str).map do |param| k, v = param.split('=', 2) [k, dequote(v)] end.flatten] end
# File lib/rack/auth/digest/params.rb, line 19 def self.split_header_value(str) str.scan( %r(\w+\=(?:"[^\"]+"|[^,]+))/ ).collect{ |v| v[0] } end
# File lib/rack/auth/digest/params.rb, line 29 def [](k) super k.to_s end
# File lib/rack/auth/digest/params.rb, line 33 def []=(k, v) super k.to_s, v.to_s end
# File lib/rack/auth/digest/params.rb, line 45 def quote(str) # From WEBrick::HTTPUtils '"' << str.gsub(%r[\\\"]/, "\\\11"") << '"' end
# File lib/rack/auth/digest/params.rb, line 39 def to_s map do |k, v| "#{k}=" + (UNQUOTED.include?(k) ? v.to_s : quote(v)) end.join(', ') end