michaeldv/awesome_print — pull request #152 by amatsuda (2014-02-14 20:12:18+00:00)
Title: Lazy-load ActionView via ActiveSupport.on_load hook

Before this change, if awesome_print gem was bundled onto a Rails app, [this line](https://github.com/michaeldv/awesome_print/blob/f36e788/lib/awesome_print.rb#L28) triggers all the ActionView related initialization process even in situations that ActionView is not actually needed (e.g. booting up the Rails console, executing a model test, running a Rake task, etc.) because referencing ActionView::Base constant immediately kicks :action_view load_hooks.

With this change,

1. In case of a non-Rails app that does not use ActiveSupport
Nothing happens.

2. An application that uses ActiveSupport but does not use ActionView
The registered :action_view on_load hook will never be executed.

3. An application that uses ActionView but doesn't have ActiveSupport constant
This never happens. actionview gem depends on activesupport gem.

4. A Rails app with ActionView
:action_view on_load hook will just be executed only when ActionView::Base is loaded by someone.