Class: RequestInterceptor::ApplicationWrapper
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- RequestInterceptor::ApplicationWrapper
- Defined in:
- lib/request_interceptor.rb
Instance Attribute Summary collapse
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
-
#initialize(pattern, application) ⇒ ApplicationWrapper
constructor
A new instance of ApplicationWrapper.
- #intercepts?(uri) ⇒ Boolean
Constructor Details
#initialize(pattern, application) ⇒ ApplicationWrapper
Returns a new instance of ApplicationWrapper.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/request_interceptor.rb', line 14 def initialize(pattern, application) @pattern = case pattern when String %r{://#{Regexp.escape(pattern)}/} else pattern end super(application) end |
Instance Attribute Details
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
12 13 14 |
# File 'lib/request_interceptor.rb', line 12 def pattern @pattern end |
Instance Method Details
#intercepts?(uri) ⇒ Boolean
26 27 28 |
# File 'lib/request_interceptor.rb', line 26 def intercepts?(uri) !!pattern.match(uri.normalize.to_s) end |