Class: Rack::Gauges

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

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ Gauges

Returns a new instance of Gauges.

Raises:

  • (ArgumentError)


7
8
9
10
# File 'lib/rack/gauges.rb', line 7

def initialize(app, options = {})
  raise ArgumentError, "Tracker must be set!" unless options[:tracker] and !options[:tracker].empty?
  @app, @options = app, options
end

Instance Method Details

#_call(env) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/rack/gauges.rb', line 14

def _call(env)
  @status, @headers, @response = @app.call(env)
  return [@status, @headers, @response] unless html?
  response = Rack::Response.new([], @status, @headers)
  @response.each { |fragment| response.write inject(fragment) }
  response.finish
end

#call(env) ⇒ Object



12
# File 'lib/rack/gauges.rb', line 12

def call(env); dup._call(env); end