Sha256: 2e07b11d050fa5144c1f350489691f33e6c10a03c4a4130b252119e8cb3b7660

Contents?: true

Size: 1.26 KB

Versions: 14

Compression:

Stored size: 1.26 KB

Contents

class Kiss
  # 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.
  module Debug
    def prepend_debug(document)
      html = <<-EOT
<style>
.kiss_debug {
text-align: left;
padding: 3px 7px;
border: 1px solid #ebe;
border-top: 1px solid #fdf;
border-bottom: 1px solid #d6d;
background-color: #fbf;
font-size: 12px;
color: #101;
}
.kiss_debug a {
color: #606;
text-decoration: none;
}
.kiss_debug a:hover {
color: #707;
text-decoration: underline;
}
.kiss_debug small {
  font-family: arial, sans-serif;
  color: #949;
  float: right;
  margin-left: 8px;
  text-align: right;
  white-space: nowrap;
}
</style>
EOT
      html += @_debug_messages.map do |object, context|
        filename, line, method = context.split(/:/)
        textmate_url = "txmt://open?url=file://" + Kiss.absolute_path(filename).url_escape + '&line=' + line
        <<-EOT
<div class="kiss_debug">
<small>kiss debug at <a href="#{textmate_url}">#{filename}:#{line}</a> #{method}</small>
<tt><b>#{object.gsub(/\</, '&lt;')}</b></tt>
</div>
EOT
      end.join
      
      document.prepend_html(html, 'body')
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
kiss-1.8.9 lib/kiss/debug.rb
kiss-1.8.8 lib/kiss/debug.rb
kiss-1.8.7 lib/kiss/debug.rb
kiss-1.8.6 lib/kiss/debug.rb
kiss-1.8.5 lib/kiss/debug.rb
kiss-1.8.4 lib/kiss/debug.rb
kiss-1.8.3 lib/kiss/debug.rb
kiss-1.8.2 lib/kiss/debug.rb
kiss-1.8.1 lib/kiss/debug.rb
kiss-1.8 lib/kiss/debug.rb
kiss-1.7.4 lib/kiss/debug.rb
kiss-1.7.2 lib/kiss/debug.rb
kiss-1.7.1 lib/kiss/debug.rb
kiss-1.7 lib/kiss/debug.rb