❤️ 1.9

This commit is contained in:
Matthew Draper 2014-10-04 08:41:03 +09:30
parent cf66278301
commit cad635995c
1 changed files with 1 additions and 1 deletions

View File

@ -91,7 +91,7 @@ module ActiveSupport
def underscore(camel_cased_word) def underscore(camel_cased_word)
return camel_cased_word unless camel_cased_word =~ /[A-Z-]|::/ return camel_cased_word unless camel_cased_word =~ /[A-Z-]|::/
word = camel_cased_word.to_s.gsub('::', '/') word = camel_cased_word.to_s.gsub('::', '/')
word.gsub!(/(?<=([A-Za-z\d])|\b)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1 && '_'}#{$2.downcase}" } word.gsub!(/(?:(?<=([A-Za-z\d]))|\b)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1 && '_'}#{$2.downcase}" }
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2') word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
word.gsub!(/([a-z\d])([A-Z])/,'\1_\2') word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
word.tr!("-", "_") word.tr!("-", "_")