Class: RequestInterceptor::Application

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/request_interceptor/application.rb

Class Method Summary collapse

Class Method Details

.customize(&customizations) ⇒ Object



5
6
7
# File 'lib/request_interceptor/application.rb', line 5

def customize(&customizations)
  RequestInterceptor.define(self, &customizations)
end

.intercept(pattern, *args, &test) ⇒ Object



9
10
11
# File 'lib/request_interceptor/application.rb', line 9

def intercept(pattern, *args, &test)
  RequestInterceptor.run(pattern => self.new(*args), &test)
end

.match(pattern) ⇒ Object Also known as: host



13
14
15
16
17
# File 'lib/request_interceptor/application.rb', line 13

def match(pattern)
  define_singleton_method(:intercept) do |*args, &test|
    super(pattern, *args, &test)
  end
end