Class: Vienna::Static
- Inherits:
-
Object
- Object
- Vienna::Static
- Defined in:
- lib/vienna.rb
Overview
Vienna::Static is just a wrapper for Rack::Static with sane and opinionated options.
It serves all files under the given root and doesn’t passes on requests for files that don’t exist.
Examples
use Vienna::Static, 'public'
Instance Method Summary collapse
- #call(env) ⇒ Object
- #header_rules ⇒ Object
- #index ⇒ Object
-
#initialize(app, root) ⇒ Static
constructor
A new instance of Static.
- #options ⇒ Object
- #root ⇒ Object
- #urls ⇒ Object
Constructor Details
Instance Method Details
#call(env) ⇒ Object
60 61 62 |
# File 'lib/vienna.rb', line 60 def call(env) Rack::Static.new(@app, ).call(env) end |
#header_rules ⇒ Object
52 53 54 |
# File 'lib/vienna.rb', line 52 def header_rules [[:all, {'Cache-Control' => 'public, max-age=3600'}]] end |
#index ⇒ Object
48 49 50 |
# File 'lib/vienna.rb', line 48 def index 'index.html' end |
#options ⇒ Object
56 57 58 |
# File 'lib/vienna.rb', line 56 def {urls: urls, root: root, index: index, header_rules: header_rules} end |
#root ⇒ Object
44 45 46 |
# File 'lib/vienna.rb', line 44 def root @root end |