Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

instance_methods includes public and protected, so reduce funcalls an…

…d object allocs
  • Loading branch information...
commit 289cc15f1a89a179116f67e5f666f4ff6d645f03 1 parent 8657826
Aaron Patterson tenderlove authored
Showing with 2 additions and 3 deletions.
  1. +2 −3 activerecord/lib/active_record/attribute_methods.rb
5 activerecord/lib/active_record/attribute_methods.rb
View
@@ -31,9 +31,8 @@ def instance_method_already_implemented?(method_name)
def defined_activerecord_methods
active_record = ActiveRecord::Base
super_klass = ActiveRecord::Base.superclass
- methods = active_record.public_instance_methods - super_klass.public_instance_methods
- methods += active_record.private_instance_methods - super_klass.private_instance_methods
- methods += active_record.protected_instance_methods - super_klass.protected_instance_methods
+ methods = (active_record.instance_methods - super_klass.instance_methods) +
+ (active_record.private_instance_methods - super_klass.private_instance_methods)
methods.map {|m| m.to_s }.to_set
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.