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

Removed support for OpenStruct in 1.1? #103

Closed Simbul closed 12 years ago

Simbul commented 12 years ago

I tried printing an OpenStruct object with awesome_print 1.0.2 and 1.1: while the former version correctly prints a formatted object, the latter does not. An example:

With awesome_print 1.0.2:

> ap OpenStruct.new(:first => 'abc', :second => [1, 2, 3])
#<OpenStruct:0x7fc50a85dfc8
    attr_reader :table = {
         :first => "abc",
        :second => [
            [0] 1,
            [1] 2,
            [2] 3
        ]
    }

With awesome_print 1.1.0:

> ap OpenStruct.new(:first => 'abc', :second => [1, 2, 3])
#<OpenStruct first="abc", second=[1, 2, 3]>

What's the reason behind dropping support for OpenStruct? Is it ever coming back? I might work on a pull request for it, but first I want to make sure I'm not stepping on anyone's feet.

michaeldv commented 12 years ago

v1.1 no longer displays internal object structure unless you explicitly specify :raw => true. Please see https://github.com/michaeldv/awesome_print/blob/master/CHANGELOG

You can reenable previous behavior by adding :raw => true to AwesomePrint.default_options in ~/.aprc

Michael

Simbul commented 12 years ago

Brilliant. Thanks!