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.07k stars 454 forks source link

Allow any object to override awesome print via #ai #309

Open matrinox opened 7 years ago

matrinox commented 7 years ago

Bug fix: Duplicate options before mutating it

Changes:

I noticed that ai calls inspector.awesome so I figured we can change it #ai without breaking much. I know this way is less efficient but for debugging, it's not going to be a huge concern.

thiagofm commented 7 years ago

I quite like this change but I would like to hear other opinions on that. In any case, it would be nice to also have this documented.

matrinox commented 7 years ago

@thiagofm How do you guys do documentation? Let me know and I'll submit it as part of this PR

matrinox commented 7 years ago

I'm happy with most of the code except one: the top_layer option. It's been a while since I've worked on this but from what I remember, I had to add the top_layer option to get around everything being tagged with <pre> tags after the root layer. Basically, I needed to separate the first call from the subsequent calls but I couldn't do that without more understanding; this was the simplest solution I could come up with.

I'm not too happy with it so I would love to hear how you guys would solve it.