From 36662ed08e2ed5d71cc21409a87aec8ebbf9a4b6 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sun, 4 May 2008 21:11:03 -0500 Subject: Replaced unnecessary class variable with a constant in whiny nil. --- activesupport/lib/active_support/whiny_nil.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/activesupport/lib/active_support/whiny_nil.rb b/activesupport/lib/active_support/whiny_nil.rb index 099619191c..36fe9510ba 100644 --- a/activesupport/lib/active_support/whiny_nil.rb +++ b/activesupport/lib/active_support/whiny_nil.rb @@ -28,12 +28,12 @@ class NilClass WHINERS = [::Array] WHINERS << ::ActiveRecord::Base if defined? ::ActiveRecord - @@method_class_map = Hash.new + METHOD_CLASS_MAP = Hash.new WHINERS.each do |klass| methods = klass.public_instance_methods - public_instance_methods class_name = klass.name - methods.each { |method| @@method_class_map[method.to_sym] = class_name } + methods.each { |method| METHOD_CLASS_MAP[method.to_sym] = class_name } end # Raises a RuntimeError when you attempt to call +id+ on +nil+. @@ -43,7 +43,7 @@ class NilClass private def method_missing(method, *args, &block) - raise_nil_warning_for @@method_class_map[method], method, caller + raise_nil_warning_for METHOD_CLASS_MAP[method], method, caller end # Raises a NoMethodError when you attempt to call a method on +nil+. -- cgit v1.2.3