awesome-print / awesome_print

Pretty print your Ruby objects with style -- in full color and with proper indentation
http://github.com/michaeldv/awesome_print
MIT License
4.08k stars 454 forks source link

awesome_inspect prints control characters (Windows) #148

Open jeffnyman opened 10 years ago

jeffnyman commented 10 years ago

I have only been able to try this on a Windows machine so far, but let's say you have this:

require 'ap'
classes = {"Trooper" => 1, "Agent" => 2}

If I run the following:

ap classes

I get this output:

{
    "Trooper" => 1,
    "Agent"   => 2
}

The numbers are colored as well. However, if I run the following:

classes.ai

I get this:

"{\n    \"Trooper\"\e[0;37m => \e[0m\e[1;34m1\e[0m,\n      \"Agent\"\e[0;37m => \e[0m\e[1;34m2\e[0m\n}"

My assumption was that awesome_inspect (ai) would essentially use the same formatting as calling "ap" on the element to be printed.