Method: String#fix_mac!
- Defined in:
- lib/name_tamer/string.rb
#fix_mac! ⇒ Object
Our list of terminal characters that indicate a non-celtic name used to include o but we removed it because of MacMurdo.
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/name_tamer/string.rb', line 88 def fix_mac! if self =~ /\bMac[A-Za-z]{2,}[^acizj]\b/ || self =~ /\bMc/ gsub!(/\b(Ma?c)([A-Za-z]+)/) { |_| Regexp.last_match[1] + Regexp.last_match[2].capitalize } # Fix Mac exceptions %w( MacEdo MacEvicius MacHado MacHar MacHin MacHlin MacIas MacIulis MacKie MacKle MacKlin MacKmin MacKmurdo MacQuarie MacLise MacKenzie ).each { |mac_name| substitute!(/\b#{mac_name}/, mac_name.capitalize) } end self # Allows chaining end |