Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Add a simple way to add internal padding, for hash-displayed output #2

Open
rubyFeedback opened this issue Apr 24, 2021 · 0 comments

Comments

@rubyFeedback
Copy link

rubyFeedback commented Apr 24, 2021

Currently if you pp a more complex object such as:

#<RBT::Cookbooks::SanitizeCookbook:0x000055e84af39ac0
 @array_show_these_entries=[],
 @be_verbose=true,
 @commandline_arguments=["htop"],
 @dataset={},
 @debug=false,
 @found=true,
 @internal_hash=
  {:make_use_of_aliases_kept_in_the_file_cookbook_aliases=>true,
   :use_this_connective_token=>"-",
   :wrap_result=>true,
   :shall_we_display_the_md5sum=>false,
   :try_to_truncate_too_long_output=>true,
   :replace_plus_with_long_name=>false,
   :report_how_many_programs_are_registered=>false},

It becomes quite hard to read the output. Would it be useful to add a ' ' each before the "=>" of a
Hash? The other parts I don't care as much, but " => " would be more readable.

Example:

     @internal_hash=
      {:make_use_of_aliases_kept_in_the_file_cookbook_aliases=>true,
       :use_this_connective_token => "-",
       :wrap_result => true,
       :shall_we_display_the_md5sum => false,
       :try_to_truncate_too_long_output => true,
       :replace_plus_with_long_name => false,
       :report_how_many_programs_are_registered => false},

API I don't mind really. Could be:

    pp obj, padding: 1

Or anything else. Should ideally be simple to type though. Or perhaps
toggle PP. I did not find any documented option for this at:

https://ruby-doc.org/stdlib-3.0.1/libdoc/pp/rdoc/PP.html

I understand that we can customize this already, but I was hoping this
be sufficiently useful to be added in general. The name could be
:padding but it could be anything else, like :internal_spacing or
:spacing or anything like that.

Thanks for reading - please proceed in any way you see fit about
this short proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant