lib/law_string.rb
#
# A better titleize that creates a usable title according to English grammar
# rules. It's coded to reduce object allocation.
#
A better titleize that creates a usable title according to English grammar
rules. It's coded to reduce object allocation.
A better titleize that creates a usable title according to English grammar rules . It ' s coded to reduce object allocation .
def titleize
    new_string = clone(freeze: false)
    new_string.tr!('_', ' ')
    final_string = new_string.split(WHITESPACES_REGEX)
                             .map { |w| titleize_word(w) }
                             .join(' ')
    final_string.capitalize_first_letter!
    final_string
  end
def titleize new_string = clone ( freeze : false ) new_string . tr! ( '_' , ' ' ) final_string = new_string . split ( WHITESPACES_REGEX ) . map { | w | titleize_word ( w ) } . join ( ' ' ) final_string . capitalize_first_letter! final_string end
A better titleize that creates a usable title according to English grammar
rules.
A better titleize that creates a usable title according to English grammar rules .