class Rack::Auth::Digest::Params
Constants
- UNQUOTED
Public Class Methods
dequote(str)
click to toggle source
# File lib/rack/auth/digest/params.rb, line 15 def self.dequote(str) # From WEBrick::HTTPUtils ret = (/\A"(.*)"\Z/ =~ str) ? $1 : str.dup ret.gsub!(/\\(.)/, "\\1") ret end
new() { |self| ... }
click to toggle source
Calls superclass method
# File lib/rack/auth/digest/params.rb, line 25 def initialize super() yield self if block_given? end
parse(str)
click to toggle source
# File lib/rack/auth/digest/params.rb, line 8 def self.parse(str) Params[*split_header_value(str).map do |param| k, v = param.split('=', 2) [k, dequote(v)] end.flatten] end
split_header_value(str)
click to toggle source
# File lib/rack/auth/digest/params.rb, line 21 def self.split_header_value(str) str.scan(/\w+\=(?:"[^\"]+"|[^,]+)/n) end
Public Instance Methods
[](k)
click to toggle source
Calls superclass method
# File lib/rack/auth/digest/params.rb, line 31 def [](k) super k.to_s end
[]=(k, v)
click to toggle source
Calls superclass method
# File lib/rack/auth/digest/params.rb, line 35 def []=(k, v) super k.to_s, v.to_s end
quote(str)
click to toggle source
# File lib/rack/auth/digest/params.rb, line 47 def quote(str) # From WEBrick::HTTPUtils '"' + str.gsub(/[\\\"]/o, "\\\1") + '"' end
to_s()
click to toggle source
# File lib/rack/auth/digest/params.rb, line 41 def to_s map do |k, v| "#{k}=#{(UNQUOTED.include?(k) ? v.to_s : quote(v))}" end.join(', ') end