Class: PermanentNotFound
- Inherits:
-
Object
- Object
- PermanentNotFound
- Defined in:
- lib/permanent_not_found.rb,
lib/permanent_not_found/version.rb
Constant Summary collapse
- CONTENT =
'404 Not Found'.freeze
- VERSION =
"0.1.1"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, content: CONTENT, paths: [], pattern: []) ⇒ PermanentNotFound
constructor
A new instance of PermanentNotFound.
Constructor Details
#initialize(app, content: CONTENT, paths: [], pattern: []) ⇒ PermanentNotFound
Returns a new instance of PermanentNotFound.
7 8 9 10 11 12 |
# File 'lib/permanent_not_found.rb', line 7 def initialize(app, content: CONTENT, paths: [], pattern: []) @app = app @content = content @paths = Set.new(paths) @pattern = Regexp.union(pattern) end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/permanent_not_found.rb', line 14 def call(env) if permanent_redirected?(env['PATH_INFO'].downcase) response_with_404 else @app.call(env) end end |