Class: Rack::Runtime
- Inherits:
-
Object
- Object
- Rack::Runtime
- Defined in:
- lib/rack/runtime.rb,
lib/rack/runtime/version.rb
Constant Summary collapse
- VERSION =
"1.0.0"
Instance Method Summary collapse
- #call(previous_state) ⇒ Object
-
#initialize(stack, label = "Runtime") ⇒ Runtime
constructor
A new instance of Runtime.
Constructor Details
#initialize(stack, label = "Runtime") ⇒ Runtime
Returns a new instance of Runtime.
14 15 16 17 |
# File 'lib/rack/runtime.rb', line 14 def initialize(stack, label = "Runtime") @stack = stack @label = label end |
Instance Method Details
#call(previous_state) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# 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 |