class Rack::Runtime

Constants

VERSION

Attributes

endstamp[R]
label[R]
startstamp[R]

Public Class Methods

new(stack, label = "Runtime") click to toggle source
# File lib/rack/runtime.rb, line 14
def initialize(stack, label = "Runtime")
  @stack = stack
  @label = label
end

Public Instance Methods

call(previous_state) click to toggle source
# File lib/rack/runtime.rb, line 19
def call(previous_state)
  @state = previous_state
  @startstamp = Time.now

  @status, @headers, @body = stack.call(state)

  @endstamp = Time.now

  unless headers.has_key?(label)
    headers[label] = runtime
  end

  [status, headers, body]
end

Private Instance Methods

body() click to toggle source
# File lib/rack/runtime.rb, line 54
        def body
  @body
end
headers() click to toggle source
# File lib/rack/runtime.rb, line 46
        def headers
  @headers
end
runtime() click to toggle source
# File lib/rack/runtime.rb, line 34
        def runtime
  (endstamp - startstamp).to_s
end
stack() click to toggle source
# File lib/rack/runtime.rb, line 38
        def stack
  @stack
end
state() click to toggle source
# File lib/rack/runtime.rb, line 42
        def state
  @state
end
status() click to toggle source
# File lib/rack/runtime.rb, line 50
        def status
  @status
end