lib/anyway/ext/class.rb in anyway_config-0.5.1 vs lib/anyway/ext/class.rb in anyway_config-1.0.0.rc1
- old
+ new
@@ -1,13 +1,15 @@
+# frozen_string_literal: true
+
module Anyway
module Ext
# Extend String through refinements
module Class
refine ::Class do
def underscore_name
return unless name
word = name[/^(\w+)/]
- word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
+ word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
word.downcase!
word
end
end
end