Skip to content
Browse files

Replaced unnecessary class variable with a constant in whiny nil.

  • Loading branch information...
1 parent 6a6b439 commit 36662ed08e2ed5d71cc21409a87aec8ebbf9a4b6 @josh josh committed May 4, 2008
Showing with 3 additions and 3 deletions.
  1. +3 −3 activesupport/lib/active_support/whiny_nil.rb
View
6 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 @@ def id
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+.

0 comments on commit 36662ed

Please sign in to comment.
Something went wrong with that request. Please try again.