Class: Rack::UrlStripper::Middleware

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

Defined Under Namespace

Classes: PathPrefixNotSpecifiedError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



6
7
8
# File 'lib/rack_url_stripper/middleware.rb', line 6

def initialize(app)
  @app = app
end

Class Method Details

.path_prefixObject



23
24
25
# File 'lib/rack_url_stripper/middleware.rb', line 23

def self.path_prefix
  configatron.rack_url_stripper.path_prefix
end

.path_prefix=(path) ⇒ Object



19
20
21
# File 'lib/rack_url_stripper/middleware.rb', line 19

def self.path_prefix=(path)
  configatron.rack_url_stripper.path_prefix = path
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/rack_url_stripper/middleware.rb', line 10

def call(env)
  require_path_prefix

  @resp = @app.call(env)
  strip_document if should_strip_document?(env)

  @resp
end