diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-06 14:32:48 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-06 14:57:25 +0200 |
commit | 894bdbd53dd82b6b28ff2672b85f57ed5ce97759 (patch) | |
tree | 6f6e2b8105891f1600b5b173f6805a1a3c6e8ea9 /activesupport/lib/active_support | |
parent | be9857c21d9bf3e4c51a159b7d4edef69e203a57 (diff) | |
download | rails-894bdbd53dd82b6b28ff2672b85f57ed5ce97759.tar.gz rails-894bdbd53dd82b6b28ff2672b85f57ed5ce97759.tar.bz2 rails-894bdbd53dd82b6b28ff2672b85f57ed5ce97759.zip |
Move variables to underscore format, update protected instance variables list.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/configurable.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/configurable.rb b/activesupport/lib/active_support/configurable.rb index 8c56a21ef7..a94446acde 100644 --- a/activesupport/lib/active_support/configurable.rb +++ b/activesupport/lib/active_support/configurable.rb @@ -2,6 +2,7 @@ require 'active_support/concern' require 'active_support/ordered_options' require 'active_support/core_ext/kernel/singleton_class' require 'active_support/core_ext/module/delegation' +require 'active_support/core_ext/array/extract_options' module ActiveSupport # Configurable provides a <tt>config</tt> method to store and retrieve @@ -51,14 +52,16 @@ module ActiveSupport # user.allowed_access # => true # def config_accessor(*names) + options = names.extract_options! + names.each do |name| - code, line = <<-RUBY, __LINE__ + 1 - def #{name}; config.#{name}; end - def #{name}=(value); config.#{name} = value; end - RUBY + reader, line = "def #{name}; config.#{name}; end", __LINE__ + writer, line = "def #{name}=(value); config.#{name} = value; end", __LINE__ - singleton_class.class_eval code, __FILE__, line - class_eval code, __FILE__, line + singleton_class.class_eval reader, __FILE__, line + singleton_class.class_eval writer, __FILE__, line + class_eval reader, __FILE__, line unless options[:instance_reader] == false + class_eval writer, __FILE__, line unless options[:instance_writer] == false end end end |