Class: Xenon::Headers::Challenge
- Inherits:
-
Object
- Object
- Xenon::Headers::Challenge
- Extended by:
- Forwardable
- Defined in:
- lib/xenon/headers/www_authenticate.rb
Instance Attribute Summary collapse
-
#auth_scheme ⇒ Object
readonly
Returns the value of attribute auth_scheme.
Instance Method Summary collapse
-
#initialize(auth_scheme, params = {}) ⇒ Challenge
constructor
A new instance of Challenge.
- #method_missing(name, *args, &block) ⇒ Object
- #respond_to_missing?(name, include_all) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(auth_scheme, params = {}) ⇒ Challenge
Returns a new instance of Challenge.
16 17 18 19 |
# File 'lib/xenon/headers/www_authenticate.rb', line 16 def initialize(auth_scheme, params = {}) @auth_scheme = auth_scheme @params = params.with_indifferent_access end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
21 22 23 24 |
# File 'lib/xenon/headers/www_authenticate.rb', line 21 def method_missing(name, *args, &block) name = name.to_sym @params.key?(name) ? @params[name] : super end |
Instance Attribute Details
#auth_scheme ⇒ Object (readonly)
Returns the value of attribute auth_scheme.
13 14 15 |
# File 'lib/xenon/headers/www_authenticate.rb', line 13 def auth_scheme @auth_scheme end |
Instance Method Details
#respond_to_missing?(name, include_all) ⇒ Boolean
26 27 28 |
# File 'lib/xenon/headers/www_authenticate.rb', line 26 def respond_to_missing?(name, include_all) @params.key?(name.to_sym) || super end |
#to_s ⇒ Object
30 31 32 33 |
# File 'lib/xenon/headers/www_authenticate.rb', line 30 def to_s param_string = @params.map { |k, v| "#{k}=#{v.quote}"}.join(', ') "#{@auth_scheme} #{param_string}" end |