Fixed Class.remove to not blow up on inheritance

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3532 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 38aae1b1
......@@ -11,12 +11,12 @@ def remove_class(*klasses)
klasses.each do |klass|
# Skip this class if there is nothing bound to this name
next unless defined?(klass.name)
basename = klass.to_s.split("::").last
parent = klass.parent
# Skip this class if it does not match the current one bound to this name
next unless klass = parent.const_get(basename)
next unless parent.const_defined?(basename) && klass = parent.const_get(basename)
parent.send :remove_const, basename unless parent == klass
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册