3
# Provides a set of methods for making it easier to debug Rails objects.
5
# Returns a YAML representation of +object+ wrapped with <pre> and </pre>.
6
# If the object cannot be converted to YAML using +to_yaml+, +inspect+ will be called instead.
7
# Useful for inspecting an object at the time of rendering.
11
# @user = User.new({ :username => 'testing', :password => 'xyz', :age => 42}) %>
14
# <pre class='debug_dump'>--- !ruby/object:User
17
# username: testing
20
# password: xyz
22
# attributes_cache: {}
30
"<pre class='debug_dump'>#{h(object.to_yaml).gsub(" ", " ")}</pre>"
31
rescue Exception => e # errors from Marshal or YAML
32
# Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback
33
"<code class='debug_dump'>#{h(object.inspect)}</code>"