lib/mangadex/utils.rb in mangadex-5.8.0 vs lib/mangadex/utils.rb in mangadex-5.9.0

- old
+ new

@@ -8,12 +8,16 @@ i == 0 && !uppercase_first_letter ? x : x.capitalize end.join end def underscore(string) - string.gsub(/([A-Z]+)(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) do + is_symbol = string.kind_of?(Symbol) + data = string.to_s + result = data.gsub(/([A-Z]+)(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) do ($1 || $2) << "_" end.tr('-', '_').downcase + + is_symbol ? result.to_sym : result end end end end