Class: HTTPAuth::Digest::AbstractHeader
- Inherits:
-
Object
- Object
- HTTPAuth::Digest::AbstractHeader
- Defined in:
- lib/httpauth/digest.rb
Overview
Superclass for all the header container classes
Direct Known Subclasses
Instance Attribute Summary collapse
-
#h ⇒ Object
readonly
holds directives and values for digest calculation.
Instance Method Summary collapse
-
#method_missing(m, *a) ⇒ Object
Redirects attribute messages to the internal directives.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *a) ⇒ Object
Redirects attribute messages to the internal directives
Example:
class Credentials < AbstractHeader
def initialize
@h = { :username => 'Ben' }
end
end
c = Credentials.new
c.username #=> 'Ben'
c.username = 'Mary'
c.username #=> 'Mary'
259 260 261 262 263 264 265 266 267 |
# File 'lib/httpauth/digest.rb', line 259 def method_missing(m, *a) if ((m.to_s =~ /^(.*)=$/) == 0) and @h.keys.include?($1.intern) @h[$1.intern] = a[0] elsif @h.keys.include? m @h[m] else raise NameError.new("undefined method `#{m}' for #{self}") end end |
Instance Attribute Details
#h ⇒ Object (readonly)
holds directives and values for digest calculation
243 244 245 |
# File 'lib/httpauth/digest.rb', line 243 def h @h end |