Kiss A simpler, smarter web application framework for Ruby

Kiss::Debug Module

Methods

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_debug(document) source

Not documented

    # File lib/kiss/debug.rb, line 7
    def prepend_debug(document)
      html = "<style>\n.kiss_debug {\ntext-align: left;\npadding: 3px 7px;\nborder: 1px solid #ebe;\nborder-top: 1px solid #fdf;\nborder-bottom: 1px solid #d6d;\nbackground-color: #fbf;\nfont-size: 12px;\ncolor: #101;\n}\n.kiss_debug a {\ncolor: #707;\ntext-decoration: none;\n}\n.kiss_debug a:hover {\ncolor: #707;\ntext-decoration: underline;\n}\n</style>\n"
      html += @debug_messages.map do |object,context|
        filename, line, method = context.split(/:/)
        textmate_url = "txmt://open?url=file://" + Kiss.url_escape(Kiss.absolute_path(filename)) + '&line=' + line
        "<div class=\"kiss_debug\">\n<tt><b>\#{object.gsub(/\\</,'&lt;')}</b></tt>\n<br><small>kiss debug output at <a href=\"\#{textmate_url}\">\#{filename}:\#{line}</a> \#{method}</small>\n</div>\n"
      end.join
      
      Kiss.html_prepend(html,document,'body')
    end
    

Disabled; run with $DEBUG to generate this.