When I make a new array/hash in irb, it prints out a nice format to show the structure, ex.
["value1", "value2", "value3"]
{"key1" => "value1"}
… but when I try to print out my variables using puts, I get them collapsed:
value1
value2
value3
key1
value1
I gather that puts is not the right command for what I want, but what is? I want to be able to view my variables in irb in the first format, not the second.
You can either use the
inspectmethod:Or, even better, use the pp (pretty print) lib: