Permalink
Browse files

clean YAML output

  • Loading branch information...
1 parent 7a29bc0 commit 44c234392058690c6449b7dd58c93a85505bf813 @mislav committed Sep 28, 2011
Showing with 7 additions and 2 deletions.
  1. +5 −0 lib/never_forget/exception_handler.rb
  2. +2 −2 lib/never_forget/list_exceptions.erb
@@ -1,6 +1,7 @@
require 'rbconfig'
require 'erubis'
require 'active_support/memoizable'
+require 'yaml'
module NeverForget
class ExceptionHandler
@@ -45,6 +46,10 @@ module TemplateHelpers
include RbConfig
extend ActiveSupport::Memoizable
+ def y(obj)
+ YAML.dump(obj).sub(/^---.*\n/, '').gsub(/ !(omap|map:BSON::OrderedHash) *$/, '')
+ end
+
def gem_path
paths = []
paths << Bundler.bundle_path << Bundler.user_bundle_path if defined? Bundler
@@ -78,12 +78,12 @@
<% if ex['params'].present? %>
<h3>Params:</h3>
-<pre class="params"><%== YAML.dump ex['params'] %></pre>
+<pre class="params"><%== y ex['params'] %></pre>
<% end %>
<% if ex['session'].present? %>
<h3>Session:</h3>
-<pre class="session"><%== YAML.dump ex['session'] %></pre>
+<pre class="session"><%== y ex['session'] %></pre>
<% end %>
<h3>Backtrace:</h3>

0 comments on commit 44c2343

Please sign in to comment.