-->

How to get awesome_print to work in pry/ruby-debug

2019-05-21 01:06发布

问题:

I super love awesome_print and ruby-debug but I can't get them to work together. AwesomePrint returns HTML for formatting but I'd it seems like ruby-debug and pry don't like multi-line output so I always end up with a complete mess. This is what it looks like when I run ap from pry or ruby-debug (in a running app).

pry(#<#<Class:0x000001117f2f58>:0x000001117ef560>)> ap @user
=> "#<User:0x000001111de888> {\n<pre>:id</pre><pre> =&gt; </pre>\n ... snip ...}"

Has anyone had any luck getting awesome_print to work in ruby-debug or pry on a running rails app? Am I just doing something wrong? I would also be happy with multi-line pp, at least that would be a huge upgrade.

Thanks!

回答1:

Specify awesome_print in your Gemfile. Bundler runs things in its own context (not exactly know how or why this is done)