Class: Rack::Printout

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/contrib/printout.rb

Overview

prints the environment and request for simple debugging

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Printout

Returns a new instance of Printout.



6
7
8
# File 'lib/rack/contrib/printout.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rack/contrib/printout.rb', line 10

def call(env)
  # See https://github.com/rack/rack/blob/main/SPEC.rdoc for details
  puts "**********\n Environment\n **************"
  puts env.inspect
  
  puts "**********\n Response\n **************"
  response = @app.call(env)
  puts response.inspect

  puts "**********\n Response contents\n **************"
  response[2].each do |chunk|
    puts chunk
  end
  puts "\n \n"
  return response
end