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

Added `:justify_hash` option. #319

Open Pysis868 opened 7 years ago

Pysis868 commented 7 years ago

Allows you to not justify hash key-value pair output. Works for indent > 0 and < 0 cases. The = 0 should be unrelated and untouched.

Added the specs I thought were needed (the minimum).

Stayed within some style checks, and ignored others where deemed appropriate.

In addition to working pn the feature per the contributing guidelines:

Pysis868 commented 7 years ago

Didn't have the most fun in the align function, what with indentations, width, and several use cases, but still had some :).

The use is fairly coupled with the left_width function that was using more at one point. Maybe I wasn't reading the code correctly when trying to change it, but something didn't feel easy when going through it.

What helped most is when I started treating left_width as the true indentation level, which I am essentially accomplishing now by reversing the indented block. Wondering if that could be rewritten more.

Pysis868 commented 7 years ago

Also noting #317 can be closed when this PR is.

imajes commented 6 years ago

hey @Pysis868 - wanted to follow up on this :) this is a 👍 PR, but i'd like to tune it up a little bit as per the comments. Do you have time to take a look?

thanks! 🥇

hakunin commented 1 year ago

I have to switch from awesome print just because of this issue causing me lost time in development.