Class: OodAppkit::FilesRackApp
- Inherits:
-
Object
- Object
- OodAppkit::FilesRackApp
- Defined in:
- lib/ood_appkit/files_rack_app.rb
Overview
Middleware that serves entries below the ‘root` given, according to the path info of the Rack request.
Instance Attribute Summary collapse
-
#root ⇒ String
The root path on file system that this app serves entries from below.
Instance Method Summary collapse
-
#call(env) ⇒ Object
Use ‘Rack::Directory` as middleware with `root` set as `dataroot` by default.
-
#initialize(root: OodAppkit.dataroot) ⇒ FilesRackApp
constructor
A new instance of FilesRackApp.
Constructor Details
#initialize(root: OodAppkit.dataroot) ⇒ FilesRackApp
Returns a new instance of FilesRackApp.
11 12 13 |
# File 'lib/ood_appkit/files_rack_app.rb', line 11 def initialize(root: OodAppkit.dataroot) @root = root.to_s end |
Instance Attribute Details
#root ⇒ String
The root path on file system that this app serves entries from below
8 9 10 |
# File 'lib/ood_appkit/files_rack_app.rb', line 8 def root @root end |
Instance Method Details
#call(env) ⇒ Object
Use ‘Rack::Directory` as middleware with `root` set as `dataroot` by default
17 18 19 |
# File 'lib/ood_appkit/files_rack_app.rb', line 17 def call(env) Rack::Directory.new(root).call(env) end |