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

Not possible to set defaults from within an app? #288

Open denishaskin opened 7 years ago

denishaskin commented 7 years ago

Is the only way to set defaults for awesome_print through ~/.aprc?

It would be good if it could be done through an initializer, but this doesn't seem to work (this is a Rails app):

config/initializers/awesome_print.rb
AwesomePrint.defaults = {
  plain: true
}

Using an external defaults file doesn't play well when using a PaaS platform like Heroku...

gerrywastaken commented 7 years ago

Hi the problem will be that awesome print will be loading after your initialiser and overriding your defaults with it's own. This may be something we address in the future, but for now, if you put require 'awesome_print' just before your defaults, that should address your issue.

Although now that you mention Heroku... I wouldn't recommend using AwesomePrint in your production environment, if that is what you are doing, as it's only really intended for development purposes.

@denishaskin

tcd commented 4 years ago

@gerrywastaken should placing the require call in front of the defaults still get around this?