mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix (Inflector::Methods#underscore): small regression
This commit is contained in:
parent
18922cccd4
commit
86faeb8386
2 changed files with 2 additions and 1 deletions
|
@ -97,7 +97,7 @@ module ActiveSupport
|
||||||
return camel_cased_word.to_s unless /[A-Z-]|::/.match?(camel_cased_word)
|
return camel_cased_word.to_s unless /[A-Z-]|::/.match?(camel_cased_word)
|
||||||
word = camel_cased_word.to_s.gsub("::", "/")
|
word = camel_cased_word.to_s.gsub("::", "/")
|
||||||
word.gsub!(inflections.acronyms_underscore_regex) { "#{$1 && '_' }#{$2.downcase}" }
|
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.tr!("-", "_")
|
||||||
word.downcase!
|
word.downcase!
|
||||||
word
|
word
|
||||||
|
|
|
@ -121,6 +121,7 @@ module InflectorTestCases
|
||||||
"ApplicationController" => "application_controller",
|
"ApplicationController" => "application_controller",
|
||||||
"Area51Controller" => "area51_controller",
|
"Area51Controller" => "area51_controller",
|
||||||
"AppCDir" => "app_c_dir",
|
"AppCDir" => "app_c_dir",
|
||||||
|
"Accountsv2N2Test" => "accountsv2_n2_test",
|
||||||
}
|
}
|
||||||
|
|
||||||
UnderscoreToLowerCamel = {
|
UnderscoreToLowerCamel = {
|
||||||
|
|
Loading…
Reference in a new issue