Class: Rack::Gauges
- Inherits:
-
Object
- Object
- Rack::Gauges
- Defined in:
- lib/rack/gauges.rb
Instance Method Summary collapse
- #_call(env) ⇒ Object
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Gauges
constructor
A new instance of Gauges.
Constructor Details
#initialize(app, options = {}) ⇒ Gauges
Returns a new instance of Gauges.
7 8 9 10 |
# File 'lib/rack/gauges.rb', line 7 def initialize(app, = {}) raise ArgumentError, "Tracker must be set!" unless [:tracker] and ![:tracker].empty? @app, @options = app, 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 |