From d78c8d99223f3a2db8222ce9ba71aadc8bf15c03 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Mon, 13 Aug 2012 21:58:40 +0100 Subject: [PATCH] Fix clash with ActiveSupport autoloader. For example, passing :message to ColorScheme#color should not cause message.rb to be loaded, and it certainly shouldn't bail when it finds Message instead of MESSAGE. --- lib/logging/color_scheme.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/logging/color_scheme.rb b/lib/logging/color_scheme.rb index 0978d8e8..2b06df1b 100644 --- a/lib/logging/color_scheme.rb +++ b/lib/logging/color_scheme.rb @@ -203,9 +203,8 @@ def to_key( t ) # Return a normalized representation of a color setting. # def to_constant( v ) - ColorScheme.const_get(v.to_s.upcase) - rescue NameError - return nil + v = v.to_s.upcase + ColorScheme.const_get(v) if ColorScheme.const_defined?(v) end # Embed in a String to clear all previous ANSI sequences. This *MUST* be