class Scratchpad::Middleware

Public Class Methods

new(app) click to toggle source
# File lib/scratchpad/middleware.rb, line 3
def initialize app
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/scratchpad/middleware.rb, line 7
def call env
  scratchpad = Scratchpad::Page.new(env)
  status, headers, response = @app.call(env)
  if headers["Content-Type"] && headers["Content-Type"].include?("text/html")
    [status, headers, [response.body + scratchpad.to_html]]
  else
    [status, headers, response]
  end
end