From 2ad522d36e81545745770502d03235a5e6f006b2 Mon Sep 17 00:00:00 2001 From: Mike Dvorkin Date: Mon, 5 Dec 2011 13:33:05 -0800 Subject: [PATCH] Don't load ActionView extension unless ActionView::Base is defined --- lib/awesome_print.rb | 2 +- lib/awesome_print/core_ext/logger.rb | 2 +- lib/awesome_print/ext/action_view.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/awesome_print.rb b/lib/awesome_print.rb index 1e01929..b2c2b13 100755 --- a/lib/awesome_print.rb +++ b/lib/awesome_print.rb @@ -23,7 +23,7 @@ unless defined?(AwesomePrint) require File.dirname(__FILE__) + "/awesome_print/ext/active_support" if defined?(ActiveSupport) || (defined?(IRB) && ENV['RAILS_ENV']) # Load remaining extensions. - require File.dirname(__FILE__) + "/awesome_print/ext/action_view" if defined?(ActionView) + require File.dirname(__FILE__) + "/awesome_print/ext/action_view" if defined?(ActionView::Base) require File.dirname(__FILE__) + "/awesome_print/ext/mongo_mapper" if defined?(MongoMapper) require File.dirname(__FILE__) + "/awesome_print/ext/mongoid" if defined?(Mongoid) require File.dirname(__FILE__) + "/awesome_print/ext/nokogiri" if defined?(Nokogiri) diff --git a/lib/awesome_print/core_ext/logger.rb b/lib/awesome_print/core_ext/logger.rb index e9c1523..fe42a53 100644 --- a/lib/awesome_print/core_ext/logger.rb +++ b/lib/awesome_print/core_ext/logger.rb @@ -17,4 +17,4 @@ module AwesomePrint end Logger.send(:include, AwesomePrint::Logger) -ActiveSupport::BufferedLogger.send(:include, AwesomePrint::Logger) if defined?(::ActiveSupport::BufferedLogger) +ActiveSupport::BufferedLogger.send(:include, AwesomePrint::Logger) if defined?(ActiveSupport::BufferedLogger) diff --git a/lib/awesome_print/ext/action_view.rb b/lib/awesome_print/ext/action_view.rb index e7a2a87..3dd15a3 100644 --- a/lib/awesome_print/ext/action_view.rb +++ b/lib/awesome_print/ext/action_view.rb @@ -15,4 +15,4 @@ module AwesomePrint end end -ActionView::Base.send(:include, AwesomePrint::ActionView) if defined?(ActionView) +ActionView::Base.send(:include, AwesomePrint::ActionView)