Class: UState::Dash::Static
- Inherits:
-
Object
- Object
- UState::Dash::Static
- Defined in:
- lib/ustate/dash/rack/static.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Static
constructor
A new instance of Static.
Constructor Details
#initialize(app, options = {}) ⇒ Static
Returns a new instance of Static.
2 3 4 5 6 |
# File 'lib/ustate/dash/rack/static.rb', line 2 def initialize(app, = {}) @app = app @root = [:root] or raise ArgumentError, "no root" @file_server = ::Rack::File.new(@root) end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/ustate/dash/rack/static.rb', line 8 def call(env) r = @file_server.call env if r[0] == 404 @app.call env else r end end |