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
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
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
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?