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

indentation added with limit and multiline=false #346

Open bmon opened 5 years ago

bmon commented 5 years ago

When using multiline and limit at the same time, the limit method prints extra indentation, within the single line of output. When multiline is disabled, limit should probably print the zipped (..) item with zero indentation.

AwesomePrint.defaults = {
  :multiline => false,
  :limit => 3,
}

result:

[1] pry(main)> {:a => 'a', :b => 'b', :c => 'c', :d => 'd', :e => 'e'}
{ :a => "a",     :b => "b" .. :e => "e" }

[2] pry(main)> {:a => { :a => {:a => 'a', :b => 'b', :c => 'c', :d => 'd', :e => 'e'}}}
{ :a => { :a => { :a => "a",             :b => "b" .. :e => "e" } } }

expected:

[1] pry(main)> {:a => 'a', :b => 'b', :c => 'c', :d => 'd', :e => 'e'}
{ :a => "a", :b => "b" .. :e => "e" }

[2] pry(main)> {:a => { :a => {:a => 'a', :b => 'b', :c => 'c', :d => 'd', :e => 'e'}}}
{ :a => { :a => { :a => "a", :b => "b" .. :e => "e" } } }