Class: RequestInterceptor::ApplicationWrapper

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/request_interceptor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#patternObject (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

Returns:

  • (Boolean)


26
27
28
# File 'lib/request_interceptor.rb', line 26

def intercepts?(uri)
  !!pattern.match(uri.normalize.to_s)
end