diff options
author | Xavier Noria <fxn@hashref.com> | 2016-07-22 23:13:42 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-07-22 23:13:49 +0200 |
commit | cfc91c31aa989826e992be29b6d5b181f654f853 (patch) | |
tree | b5ec5569b22f8c796de89335c5ecc7de047130bc /activesupport/lib/active_support/configurable.rb | |
parent | aea0e5cd709e0fc53e1ba4e87235b8ee3f4bc155 (diff) | |
download | rails-cfc91c31aa989826e992be29b6d5b181f654f853.tar.gz rails-cfc91c31aa989826e992be29b6d5b181f654f853.tar.bz2 rails-cfc91c31aa989826e992be29b6d5b181f654f853.zip |
systematic revision of =~ usage in AS
Where appropriate prefer the more concise Regexp#match?, String#include?,
String#start_with?, and String#end_with?
Diffstat (limited to 'activesupport/lib/active_support/configurable.rb')
-rw-r--r-- | activesupport/lib/active_support/configurable.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/configurable.rb b/activesupport/lib/active_support/configurable.rb index 8256c325af..c2c99459f2 100644 --- a/activesupport/lib/active_support/configurable.rb +++ b/activesupport/lib/active_support/configurable.rb @@ -1,6 +1,7 @@ require 'active_support/concern' require 'active_support/ordered_options' require 'active_support/core_ext/array/extract_options' +require 'active_support/core_ext/regexp' module ActiveSupport # Configurable provides a <tt>config</tt> method to store and retrieve @@ -107,7 +108,7 @@ module ActiveSupport options = names.extract_options! names.each do |name| - raise NameError.new('invalid config attribute name') unless name =~ /\A[_A-Za-z]\w*\z/ + raise NameError.new('invalid config attribute name') unless /\A[_A-Za-z]\w*\z/.match?(name) reader, reader_line = "def #{name}; config.#{name}; end", __LINE__ writer, writer_line = "def #{name}=(value); config.#{name} = value; end", __LINE__ @@ -145,4 +146,3 @@ module ActiveSupport end end end - |