Class: Rescodegen::CodeFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/rescodegen/code_formatter/code_formatter.rb

Instance Method Summary collapse

Instance Method Details

#format_string(string) ⇒ Object



5
6
7
8
# File 'lib/rescodegen/code_formatter/code_formatter.rb', line 5

def format_string(string)
        string.sub(/^[A-Z]+/) { |s| downcase_string_unless_acronym(s) }
        .gsub(/_[A-Z]+/) { |s| downcase_string_unless_acronym(s) }
end