lib/active_support/configurable.rb in activesupport-5.0.7.2 vs lib/active_support/configurable.rb in activesupport-5.1.0.beta1

- old
+ new

@@ -1,8 +1,9 @@ -require 'active_support/concern' -require 'active_support/ordered_options' -require 'active_support/core_ext/array/extract_options' +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 # configuration options as an <tt>OrderedHash</tt>. module Configurable @@ -105,11 +106,11 @@ # User.hair_colors # => [:brown, :black, :blonde, :red] def config_accessor(*names) 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__ singleton_class.class_eval reader, __FILE__, reader_line @@ -143,6 +144,5 @@ def config @_config ||= self.class.config.inheritable_copy end end end -