Rails 2.2 compat

This commit is contained in:
Benjamin Fleischer 2017-07-17 19:54:05 -05:00
parent 793ee3dd11
commit 275007843e

View File

@ -25,7 +25,7 @@ module AMS
#
# camelize(underscore('SSLError')) # => "SslError"
def underscore(camel_cased_word)
return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)
return camel_cased_word unless /[A-Z-]|::/.match(camel_cased_word)
word = camel_cased_word.to_s.gsub("::".freeze, "/".freeze)
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2'.freeze)
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2'.freeze)