diff options
author | Alexey Gaziev <alex.gaziev@gmail.com> | 2012-04-29 01:12:08 +0400 |
---|---|---|
committer | Alexey Gaziev <alex.gaziev@gmail.com> | 2012-04-29 03:12:07 +0400 |
commit | f1220516fba3add0f3b491a440fd6525fdb61587 (patch) | |
tree | 1eda8dd8620ee741fc4a2996a4bed9d402335685 /activesupport | |
parent | 92572241e2966529360106aec086373d56904dbc (diff) | |
download | rails-f1220516fba3add0f3b491a440fd6525fdb61587.tar.gz rails-f1220516fba3add0f3b491a440fd6525fdb61587.tar.bz2 rails-f1220516fba3add0f3b491a440fd6525fdb61587.zip |
Indentation for private methods
https://github.com/rails/rails/commit/e7d55f734aae204115d0a04a2db774ac364c1312
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/class/attribute.rb | 6 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/class/delegating_attributes.rb | 32 |
2 files changed, 18 insertions, 20 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/attribute.rb b/activesupport/lib/active_support/core_ext/class/attribute.rb index 305ed4964b..c64685a694 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute.rb @@ -109,7 +109,7 @@ class Class end private - def singleton_class? - ancestors.first != self - end + def singleton_class? + ancestors.first != self + end end diff --git a/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb b/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb index 0634f20e3c..ff870f5fd1 100644 --- a/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb +++ b/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb @@ -20,23 +20,21 @@ class Class define_method("#{name}?") { !!send("#{name}") } if options[:instance_reader] != false end -private - - # Take the object being set and store it in a method. This gives us automatic - # inheritance behavior, without having to store the object in an instance - # variable and look up the superclass chain manually. - def _stash_object_in_method(object, method, instance_reader = true) - singleton_class.remove_possible_method(method) - singleton_class.send(:define_method, method) { object } - remove_possible_method(method) - define_method(method) { object } if instance_reader - end - - def _superclass_delegating_accessor(name, options = {}) - singleton_class.send(:define_method, "#{name}=") do |value| - _stash_object_in_method(value, name, options[:instance_reader] != false) + private + # Take the object being set and store it in a method. This gives us automatic + # inheritance behavior, without having to store the object in an instance + # variable and look up the superclass chain manually. + def _stash_object_in_method(object, method, instance_reader = true) + singleton_class.remove_possible_method(method) + singleton_class.send(:define_method, method) { object } + remove_possible_method(method) + define_method(method) { object } if instance_reader end - send("#{name}=", nil) - end + def _superclass_delegating_accessor(name, options = {}) + singleton_class.send(:define_method, "#{name}=") do |value| + _stash_object_in_method(value, name, options[:instance_reader] != false) + end + send("#{name}=", nil) + end end |