How can i format and indent obj.inspect in an outputted file?

1
votes

Posted by: Memor-X on 06/24/2016 | Add Revision

So i want to examine the data for some of the classes like $data_enemies and at the moment i can output it to a file like this

file = File.open("enemies_dump.txt", "wb")
Marshal.dump($data_enemies.inspect, file)
file.close

what i get is this

enter image description here

^ the screenshot is to show the invisible characters at the start of the file which didn't appear in pastebin.

I would like to know how i can get this output more readable like with PHP's var_dump where everything isn't on just one huge line and nested objects get indented more

Visit Website