Kiss A simpler, smarter web application framework for Ruby

Kiss::Bench Module

Description

Generates HTML reports on exceptions raised from the app, showing the backtrace with clickable stack frames with TextMate links to source files, plus login hash, last SQL, GET/POST params, cookies, and Rack environment variables.

Public Instance Methods

prepend_benchmarks(document) source

Not documented

    # File lib/kiss/bench.rb, line 7
    def prepend_benchmarks(document)
      html = "<style>\n.kiss_bench {\ntext-align: left;\npadding: 3px 7px;\nborder: 1px solid #ec4;\nborder-top: 1px solid #fff4bb;\nborder-bottom: 1px solid #d91;\nbackground-color: #ffe590;\nfont-size: 12px;\ncolor: #101;\n}\n.kiss_bench a {\ncolor: #930;\ntext-decoration: none;\n}\n.kiss_bench a:hover {\ncolor: #930;\ntext-decoration: underline;\n}\n</style>\n"
      html += @benchmarks.map do |item|
        start_link = context_link(item[:start_context])
        end_link = context_link(item[:end_context])
        
        "<div class=\"kiss_bench\">\n<tt><b>\#{item[:label].to_s.gsub(/\\</,'&lt;')} duration: \#{sprintf(\"%0.3f\",item[:end_time].to_f - item[:start_time].to_f)} s</b></tt>\n<small style=\"line-height: 105%; display: block; padding-bottom: 3px\">kiss bench<br/>started at \#{start_link}<br/>ended at \#{end_link || 'controller completion'}</small>\n</div>\n"
      end.join
      
      Kiss.html_prepend(html,document,'body')
    end
    

Disabled; run with $DEBUG to generate this.