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

Kernel#ap should not return a value #69

Closed manur closed 12 years ago

manur commented 12 years ago

I love ap!

But, everytime I use it on a large object, I have to hack it to not return the object itself like so:

>> ap [1,2,3,4]; nil

This commit swaps the convention of Kernel#ap to not return the object itself, in a way that's consistent with puts.

>> a = puts '1'
>> a
=> nil

Bumped the version number by a minor release to differentiate from the earlier convention.

michaeldv commented 12 years ago

We already had a discussion on this:

https://github.com/michaeldv/awesome_print/issues/32 https://github.com/michaeldv/awesome_print/commit/05726bfd9137e5802b474628473894a047142ffb

See README on how to integrate ap with irb so you won't need >> ap object

Michael

manur commented 12 years ago

Thanks for the pointer @michaeldv. I did look through README.md, but I wasn't able to find an option to limit output by default. The only thing that seemed plausible is 'limit', but that didn't do it. Could you point me to what you were referring to?

:indent     => 4,      # Indent using 4 spaces.
:index      => true,   # Display array indices.
:html       => false,  # Use ANSI color codes rather than HTML.
:multiline  => true,   # Display in multiple lines.
:plain      => false,  # Use colors.
:sort_keys  => false,  # Do not sort hash keys.
:limit      => false,  # Limit large output for arrays and hashes. Set to a boolean or integer.
:color => {
  :args       => :pale,
  :array      => :white,
  :bigdecimal => :blue,
  :class      => :yellow,
  :date       => :greenish,
  :falseclass => :red,
  :fixnum     => :blue,
  :float      => :blue,
  :hash       => :pale,
  :keyword    => :cyan,
  :method     => :purpleish,
  :nilclass   => :red,
  :string     => :yellowish,
  :struct     => :pale,
  :symbol     => :cyanish,
  :time       => :greenish,
  :trueclass  => :green,
  :variable   => :cyanish
}