class Rack::Backstage

Constants

File

Public Class Methods

new(app, path) click to toggle source
   # File lib/rack/contrib/backstage.rb
 7 def initialize(app, path)
 8   @app = app
 9   @file = File.expand_path(path)
10 end

Public Instance Methods

call(env) click to toggle source
   # File lib/rack/contrib/backstage.rb
12 def call(env)
13   if File.exists?(@file)
14     content = File.read(@file)
15     length = content.bytesize.to_s
16     [503, {'Content-Type' => 'text/html', 'Content-Length' => length}, [content]]
17   else
18     @app.call(env)
19   end
20 end