diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-18 17:32:08 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-18 17:32:08 -0800 |
commit | 289cc15f1a89a179116f67e5f666f4ff6d645f03 (patch) | |
tree | 4b3cb33b4878b604b8bd6529e456573c4b999b65 /activerecord/lib/active_record | |
parent | 8657826f416fa2f073c78ba0fab96c33f7b92c39 (diff) | |
download | rails-289cc15f1a89a179116f67e5f666f4ff6d645f03.tar.gz rails-289cc15f1a89a179116f67e5f666f4ff6d645f03.tar.bz2 rails-289cc15f1a89a179116f67e5f666f4ff6d645f03.zip |
instance_methods includes public and protected, so reduce funcalls and object allocs
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index 40ff273846..284ae2bebc 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -31,9 +31,8 @@ module ActiveRecord 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 |