When I want to debug the following hash, it returns try2test2.
dictionary = {
"test" => 2,
"try" => 2
}
puts dictionary
# => try2test2
Are there any other ways to do it so that it will give you the full list like {'test': 2, 'try': 2}?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As V. Melnychuk mentioned, JSON is a good option, just remember to import the “json” module first:
in general, you can retreive a readable string version of an object by calling
inspect on it:
finally, there is a “pp” module to pretty-print variable (pretty much like the pprint module in python):
Hope it helps !