Class: Rack::Auth::Digest::Params
- Defined in:
- lib/gems/rack-0.9.1/lib/rack/auth/digest/params.rb
Constant Summary collapse
- UNQUOTED =
['qop', 'nc', 'stale']
Class Method Summary collapse
-
.dequote(str) ⇒ Object
From WEBrick::HTTPUtils.
- .parse(str) ⇒ Object
- .split_header_value(str) ⇒ Object
Instance Method Summary collapse
- #[](k) ⇒ Object
- #[]=(k, v) ⇒ Object
-
#initialize {|_self| ... } ⇒ Params
constructor
A new instance of Params.
-
#quote(str) ⇒ Object
From WEBrick::HTTPUtils.
- #to_s ⇒ Object
Methods inherited from Hash
Constructor Details
#initialize {|_self| ... } ⇒ Params
Returns a new instance of Params.
24 25 26 27 28 |
# File 'lib/gems/rack-0.9.1/lib/rack/auth/digest/params.rb', line 24 def initialize super yield self if block_given? end |
Class Method Details
.dequote(str) ⇒ Object
From WEBrick::HTTPUtils
14 15 16 17 18 |
# File 'lib/gems/rack-0.9.1/lib/rack/auth/digest/params.rb', line 14 def self.dequote(str) # From WEBrick::HTTPUtils ret = (/\A"(.*)"\Z/ =~ str) ? $1 : str.dup ret.gsub!(/\\(.)/, "\\1") ret end |
.parse(str) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/gems/rack-0.9.1/lib/rack/auth/digest/params.rb', line 6 def self.parse(str) split_header_value(str).inject(new) do |header, param| k, v = param.split('=', 2) header[k] = dequote(v) header end end |
.split_header_value(str) ⇒ Object
20 21 22 |
# File 'lib/gems/rack-0.9.1/lib/rack/auth/digest/params.rb', line 20 def self.split_header_value(str) str.scan( /(\w+\=(?:"[^\"]+"|[^,]+))/n ).collect{ |v| v[0] } end |
Instance Method Details
#[](k) ⇒ Object
30 31 32 |
# File 'lib/gems/rack-0.9.1/lib/rack/auth/digest/params.rb', line 30 def [](k) super k.to_s end |
#[]=(k, v) ⇒ Object
34 35 36 |
# File 'lib/gems/rack-0.9.1/lib/rack/auth/digest/params.rb', line 34 def []=(k, v) super k.to_s, v.to_s end |
#quote(str) ⇒ Object
From WEBrick::HTTPUtils
47 48 49 |
# File 'lib/gems/rack-0.9.1/lib/rack/auth/digest/params.rb', line 47 def quote(str) # From WEBrick::HTTPUtils '"' << str.gsub(/[\\\"]/o, "\\\1") << '"' end |