How to format '.inspect' output?

is there a way to get the .inspect output formatted like the <%= debug
whatever %> output in views?
i’m using ruby-debug. would be great if the output could be more
readable.
or am i missing something?

regads

On 1/16/07, dweinand [email protected] wrote:

is there a way to get the .inspect output formatted like the <%= debug
whatever %> output in views?
i’m using ruby-debug. would be great if the output could be more
readable.

debug() just calls to_yaml on whatever you pass it.

So,

require ‘yaml’

variable.to_yaml

instead of variable.inspect.

Also, if your debugger is automatically calling #inspect:

require ‘yaml’
class Object
def inspect
to_yaml
end
end


Chris W.

thx, already tried variable.to_yaml.

its a bit more readable.
but unfortunately the \n will not be displayed as line breaks in
console window.

but i realised that pp will format the ruby-debug output readable.
don’t know if its a bug. “pp” is documented as alias for “p expression
=> evaluate expression and print its value”

so pp fits for my needs. 'til now.

thanks anyway

just seen that the development console isnt dispaying the yaml \n as
line breaks.
am i missing some settings?