Sha256: ee5b783c2dc522b0b835a318d2b8d15be7227ff547783aa05100bcce053772ba

Contents?: true

Size: 344 Bytes

Versions: 8

Compression:

Stored size: 344 Bytes

Contents

class Timing
  def initialize(app)
    @app = app
  end

  def call(env)
    env['Timing-Start'] = Time.now.to_i

    ts = Time.now
    status, headers, body = @app.call(env)
    elapsed_time = Time.now - ts
    puts "Timing: #{env['REQUEST_METHOD']} #{env['REQUEST_URI']} #{elapsed_time.round(3)}"
    return [status, headers, body]
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
meta-api-0.0.8 examples/rack_app/timing.rb
meta-api-0.0.7 examples/rack_app/timing.rb
meta-api-0.0.6 examples/rack_app/timing.rb
meta-api-0.0.5 examples/rack_app/timing.rb
meta-api-0.0.4 examples/rack_app/timing.rb
meta-api-0.0.3 examples/rack_app/timing.rb
meta-api-0.0.2 examples/rack_app/timing.rb
meta-api-0.0.1 examples/rack_app/timing.rb