Class: Workarea::BasicAuth::Path
- Inherits:
-
Object
- Object
- Workarea::BasicAuth::Path
- Defined in:
- lib/workarea/basic_auth/path.rb
Instance Attribute Summary collapse
-
#regexp ⇒ Object
readonly
Returns the value of attribute regexp.
Instance Method Summary collapse
-
#initialize(string, *http_methods) ⇒ Path
constructor
A new instance of Path.
- #matches?(request) ⇒ Boolean
Constructor Details
#initialize(string, *http_methods) ⇒ Path
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/workarea/basic_auth/path.rb', line 6 def initialize(string, *http_methods) path = Regexp.escape(string).gsub('\*', ".*?") @regexp = Regexp.new("^#{path}$", true) if http_methods && http_methods.first.is_a?(Proc) @proc = http_methods.first end @http_methods = http_methods end |
Instance Attribute Details
#regexp ⇒ Object (readonly)
Returns the value of attribute regexp.
4 5 6 |
# File 'lib/workarea/basic_auth/path.rb', line 4 def regexp @regexp end |
Instance Method Details
#matches?(request) ⇒ Boolean
17 18 19 |
# File 'lib/workarea/basic_auth/path.rb', line 17 def matches?(request) path_matches?(request) && request_matches?(request) end |