diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-05-04 21:11:03 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-05-04 21:11:03 -0500 |
commit | 36662ed08e2ed5d71cc21409a87aec8ebbf9a4b6 (patch) | |
tree | b1ff7249cd29352b10bf1ae78da456f96ccb2b43 /activesupport | |
parent | 6a6b4392c16c665eb713705f2b38e959a658eeef (diff) | |
download | rails-36662ed08e2ed5d71cc21409a87aec8ebbf9a4b6.tar.gz rails-36662ed08e2ed5d71cc21409a87aec8ebbf9a4b6.tar.bz2 rails-36662ed08e2ed5d71cc21409a87aec8ebbf9a4b6.zip |
Replaced unnecessary class variable with a constant in whiny nil.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/whiny_nil.rb | 6 |
1 files 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+. |