Sha256: 43600493c7abe1241f53d4afa3be52a0e859beaef4411043e0b2c1f0398f30df
Contents?: true
Size: 1020 Bytes
Versions: 20
Compression:
Stored size: 1020 Bytes
Contents
require "digest" module Rack::Insight class ActiveResourcePanel < Panel require 'rack/insight/panels/active_resource_panel/query' #require "rack/insight/panels/sql_panel/panel_app" #require "rack/insight/panels/sql_panel/query" def after_detect(method_call, timing, arguments, results) body = "<no body>" if results.respond_to? :body body = results.body end store(@env, RequestResult.new(arguments[0], arguments[1..-1], timing.duration, method_call.backtrace[0..5], body)) end def total_time(queries) (queries.inject(0) do |memo, query| memo + query.time end) end def heading_for_request(number) queries = retrieve(number) "ARes: #{queries.size} Queries (%.2fms)" % total_time(queries) end def content_for_request(number) queries = retrieve(number) logger.debug{ "ARes: #{queries.inspect}" } if verbose(:debug) render_template "panels/active_resource", :queries => queries end end end
Version data entries
20 entries across 20 versions & 1 rubygems