Class: Fewer::MiddleWare

Inherits:
Object
  • Object
show all
Defined in:
lib/fewer/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ MiddleWare

Returns a new instance of MiddleWare.



3
4
5
6
7
# File 'lib/fewer/middleware.rb', line 3

def initialize(app, options = {})
  @options = options
  @app = app
  @mount = @options[:mount]
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/fewer/middleware.rb', line 9

def call(env)
  if env['PATH_INFO'] =~ /^#{@mount}/
    App.new(@options).call(env)
  else
    @app.call(env)
  end
end