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

awesome_object output? #104

Closed rking closed 12 years ago

rking commented 12 years ago

I feel so dumb. Here are some things to throw at me, if you want: :skull: :cd: :collision: :cocktail: :beginner: :hankey: :monkey: :8ball: :rage: :pager: :lock_with_ink_pen: :japanese_goblin: :x:

I'll weather the storm. I deserve it.

But I'm really missing how you're supposed to get awesome_object output by default. I want to be able to say:

    class Foo; def initialize; @a=@b=@c="asdf"*50 end end;
    ap Foo.new

All I get is a one-line mess:

#<Foo:0x00000000a46488 @c="asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfas…

I can do this:

puts AwesomePrint::Inspector.new.instance_variable_get(:@formatter).send \
 :awesome_object, Foo.new

…but somehow I don't think that is the intended way to get this to work. ☺ (And, also, it doesn't recurse).

Any hints?

Thanks! —☈

michaeldv commented 12 years ago

ap Foo.new, :raw => true

Since v1.1.0 objects are no longer recursively formatted by default (see Changelog). If you want to make it a default again add :raw => true in ~/.aprc

HTH Michael

rking commented 12 years ago

Well, that's… awesome.

(I don't think I would have tried ":raw" to get formatted output. What's the logic, there?)

Thanks!