Class: Rack::Backstage
- Inherits:
-
Object
- Object
- Rack::Backstage
- Defined in:
- lib/rack/contrib/backstage.rb
Constant Summary collapse
- File =
::File
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, path) ⇒ Backstage
constructor
A new instance of Backstage.
Constructor Details
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/rack/contrib/backstage.rb', line 10 def call(env) if File.exists?(@file) content = File.read(@file) length = "".respond_to?(:bytesize) ? content.bytesize.to_s : content.size.to_s [503, {'Content-Type' => 'text/html', 'Content-Length' => length}, [content]] else @app.call(env) end end |