lib/active_support/inflector/methods.rb in activesupport-7.0.0.alpha2 vs lib/active_support/inflector/methods.rb in activesupport-7.0.0.rc1

- old
+ new

@@ -95,11 +95,11 @@ # camelize(underscore('SSLError')) # => "SslError" def underscore(camel_cased_word) return camel_cased_word.to_s unless /[A-Z-]|::/.match?(camel_cased_word) word = camel_cased_word.to_s.gsub("::", "/") word.gsub!(inflections.acronyms_underscore_regex) { "#{$1 && '_' }#{$2.downcase}" } - word.gsub!(/([A-Z\d]+)(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) { ($1 || $2) << "_" } + word.gsub!(/([A-Z]+)(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) { ($1 || $2) << "_" } word.tr!("-", "_") word.downcase! word end @@ -107,10 +107,10 @@ # # Specifically, performs these transformations: # # * Applies human inflection rules to the argument. # * Deletes leading underscores, if any. - # * Removes a "_id" suffix if present. + # * Removes an "_id" suffix if present. # * Replaces underscores with spaces, if any. # * Downcases all words except acronyms. # * Capitalizes the first word. # The capitalization of the first word can be turned off by setting the # +:capitalize+ option to false (default is true).