only create custom accessors for Kernel:: methods

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7731 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Tobias Lütke
2007-10-03 21:48:49 +00:00
parent b31aa639e7
commit 406ea8f31d

View File

@@ -76,18 +76,11 @@ module ActiveRecord
end
end
def instance_method_already_defined?(method_name)
method_defined?(method_name) ||
private_method_defined?(method_name) ||
protected_method_defined?(method_name)
end
def instance_method_already_implemented?(method_name)
if instance_method_already_defined?(method_name)
# method is defined but maybe its a simple library or kernel method
# which we could simply override:
@@_overrideable_method_names ||= Set.new(Object.instance_methods + Kernel.methods)
@@_overrideable_method_names.include?(method_name) ? false : true
if method_defined?(method_name) || private_method_defined?(method_name) || protected_method_defined?(method_name)
# method is defined but maybe its a simple Kernel:: method which we could simply override
@@_overrideable_kernel_methods ||= Set.new(Kernel.methods)
!@@_overrideable_kernel_methods.include?(method_name)
else
false
end