Class: Vienna::Application
- Inherits:
-
Object
- Object
- Vienna::Application
- Defined in:
- lib/vienna.rb
Overview
Vienna::Application serves all files under the given root directory using Vienna::Static. If a file/path doen’t exist, Vienna::NotFound is run, which always returns a status of 404 and the contents of 404.html or ‘’Not Found’‘ if one does not exist.
Examples
run Vienna::Application.new('_site')
run Vienna::Application.new # The root defaults to 'public'
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(root = 'public') ⇒ Application
constructor
A new instance of Application.
Constructor Details
#initialize(root = 'public') ⇒ Application
Returns a new instance of Application.
126 127 128 129 130 131 |
# File 'lib/vienna.rb', line 126 def initialize(root = 'public') @app = Rack::Builder.new do use Static, root run NotFound.new("#{root}/404.html") end end |
Instance Method Details
#call(env) ⇒ Object
133 134 135 |
# File 'lib/vienna.rb', line 133 def call(env) @app.call(env) end |