In PHP you can do:
print_r($var) or vardump($var)
which prints "human-readible" information about variable.
Is there equivalent functions / helpers for those in Ruby / Rails ?
In Rails templates you can do
<%= debug an_object %> and it will do nice HTML PRE output.
Try using pp. You will need to require it in scripts (or in irb if your .irbc doesn't already do this):
require 'pp' Then you can 'PrettyPrint' an object thus:
pp object
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With