lib/noble_names/core_ext/string.rb
# Does the same as {String#to_title} but replaces the old string.
# @example Titleize a name
#   str = 'jamie of windsor'
#   str.to_title!
#   str                     #=> 'Jamie of Windsor'
Does the same as {String#to_title} but replaces the old string.
Does the same as { String#to_title } but replaces the old string .
def to_title!
        words = split(/\s+/)
        if words.any? { |w| NobleNames.business_particle? w }
          NobleNames.correct_business_particles words
        else
          words.map! { |w| NobleNames.noble_capitalize(w) }
        end
        replace(words * ' ')
      end
def to_title! words = split ( / \s + / ) if words . any? { | w | NobleNames . business_particle? w } NobleNames . correct_business_particles words else words . map! { | w | NobleNames . noble_capitalize ( w ) } end replace ( words * ' ' ) end
Does the same as {String#to_title} but replaces the old string.
Does the same as { String#to_title } but replaces the old string .
example
Titleize a name str = 'jamie of windsor' str.to_title. str #=> 'Jamie of Windsor'
Titleize a name str = ' jamie of windsor ' str . to_title . str # = > ' Jamie of Windsor '