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

Version Path
rack-insight-0.6.4 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.6.3 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.6.2 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.30 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.29 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.28 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.27 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.26 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.25 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.24 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.23 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.22 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.21 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.20 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.19 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.18 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.17 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.16 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.15 lib/rack/insight/panels/active_resource_panel.rb
rack-insight-0.5.14 lib/rack/insight/panels/active_resource_panel.rb