Class: Riemann::Dash::Static
- Inherits:
-
Object
- Object
- Riemann::Dash::Static
- Defined in:
- lib/riemann/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/riemann/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/riemann/dash/rack/static.rb', line 8 def call(env) r = @app.call env if r[0] < 200 or 400 <= r[0] @file_server.call env else r end end |