Fix (Inflector::Methods#underscore): small regression
This commit is contained in:
parent
18922cccd4
commit
86faeb8386
|
@ -97,7 +97,7 @@ module ActiveSupport
|
|||
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
|
||||
|
|
|
@ -121,6 +121,7 @@ module InflectorTestCases
|
|||
"ApplicationController" => "application_controller",
|
||||
"Area51Controller" => "area51_controller",
|
||||
"AppCDir" => "app_c_dir",
|
||||
"Accountsv2N2Test" => "accountsv2_n2_test",
|
||||
}
|
||||
|
||||
UnderscoreToLowerCamel = {
|
||||
|
|
Loading…
Reference in New Issue