Class: Utopia::Redirection::DirectoryIndex
- Inherits:
-
Redirection
- Object
- Redirection
- Utopia::Redirection::DirectoryIndex
- Defined in:
- lib/utopia/redirection.rb
Instance Attribute Summary
Attributes inherited from Redirection
Instance Method Summary collapse
- #[](path) ⇒ Object
-
#initialize(app, index = 'index') ⇒ DirectoryIndex
constructor
A new instance of DirectoryIndex.
Methods inherited from Redirection
#cache_control, #call, #freeze, #headers, #redirect
Constructor Details
#initialize(app, index = 'index') ⇒ DirectoryIndex
Returns a new instance of DirectoryIndex.
126 127 128 129 130 131 |
# File 'lib/utopia/redirection.rb', line 126 def initialize(app, index = 'index') @app = app @index = 'index' super(app) end |
Instance Method Details
#[](path) ⇒ Object
133 134 135 136 137 |
# File 'lib/utopia/redirection.rb', line 133 def [] path if path.end_with?('/') return redirect(path + @index) end end |