Method: String#upcase_initials!
- Defined in:
- lib/name_tamer/string.rb
#upcase_initials! ⇒ Object
Upcase words with no vowels, e.g JPR Williams Except Ng
135 136 137 138 |
# File 'lib/name_tamer/string.rb', line 135 def upcase_initials! gsub!(/\b([bcdfghjklmnpqrstvwxz]+)\b/i) { |_| Regexp.last_match[1].upcase } gsub!(/\b(NG)\b/i) { |_| Regexp.last_match[1].capitalize } || self # http://en.wikipedia.org/wiki/Ng end |