module Identificamex::Nombre::Mayusculas

Public Instance Methods

hash_vocales() click to toggle source
# File lib/identificamex/nombre/mayusculas.rb, line 18
def hash_vocales
  @hash_vocales ||= {'á' => 'a',
                     'é' => 'e',
                     'í' => 'i',
                     'ó' => 'o',
                     'ú' => 'u',
                     'ü' => 'u',
                     'Á' => 'A',
                     'É' => 'E',
                     'Í' => 'I',
                     'Ó' => 'O',
                     'Ú' => 'U',
                     'Ü' => 'U'}
end
mayusculas(str) click to toggle source
# File lib/identificamex/nombre/mayusculas.rb, line 5
def mayusculas(str)
  return if str.nil?
  str
  .gsub(/[ÁÉÍÓÚÜáéíóúü]/, hash_vocales)
  .upcase
  .gsub(/ñ/, 'Ñ')
  .gsub(/,/, '')
  .gsub(/'/, '')
  .gsub(/\./, ' ')
  .squeeze(' ')
  .strip
end