Sha256: 1282634fb33d0ee22ce2df3dfbaf1efb717567ec5a52f6d123e9b1af3936c505
Contents?: true
Size: 891 Bytes
Versions: 1
Compression:
Stored size: 891 Bytes
Contents
module Rack class Perf require_relative "perf/version" attr_reader :starttime private :starttime attr_reader :endtime private :endtime attr_reader :label private :label def initialize(stack, label = "X-Perf-Timing") @stack = stack @label = label end def call(previous_state) @state = previous_state @starttime = Time.now @status, @headers, @body = stack.call(state) @endtime = Time.now unless headers.has_key?(label) headers[label] = runtime end [status, headers, body] end private def runtime (endtime - starttime).to_s end private def stack @stack end private def state @state end private def headers @headers end private def status @status end private def body @body end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rack-perf-1.0.2 | lib/rack/perf.rb |