diff options
author | José Valim <jose.valim@gmail.com> | 2011-06-19 00:06:44 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-06-19 00:06:48 -0300 |
commit | e6f15f0553a44b746e5d319eb0186b579bb3a2db (patch) | |
tree | d3f81570bf8d42d4a175d2a8c9f4e1b68ee1b4bb /activesupport/lib/active_support | |
parent | 7d4606156b9d2b1900e99b9fb5cd08529b8f95a0 (diff) | |
download | rails-e6f15f0553a44b746e5d319eb0186b579bb3a2db.tar.gz rails-e6f15f0553a44b746e5d319eb0186b579bb3a2db.tar.bz2 rails-e6f15f0553a44b746e5d319eb0186b579bb3a2db.zip |
Ugh, the class_attribute pull request broke the build. fix it.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/class/attribute.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/attribute.rb b/activesupport/lib/active_support/core_ext/class/attribute.rb index 0d4033329e..ca9b2c1b60 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute.rb @@ -1,5 +1,6 @@ require 'active_support/core_ext/kernel/singleton_class' require 'active_support/core_ext/module/remove_method' +require 'active_support/core_ext/array/extract_options' class Class # Declare a class-level attribute whose value is inheritable by subclasses. @@ -65,13 +66,9 @@ class Class # # object.setting = false # => NoMethodError def class_attribute(*attrs) - instance_reader = true - instance_writer = true - if attrs.last.is_a?(Hash) - instance_accessors = attrs.pop - instance_reader = instance_accessors[:instance_reader] - instance_writer = instance_accessors[:instance_writer] - end + options = attrs.extract_options! + instance_reader = options.fetch(:instance_reader, true) + instance_writer = options.fetch(:instance_writer, true) attrs.each do |name| class_eval <<-RUBY, __FILE__, __LINE__ + 1 |