module Identificamex
  module Nombre
    module Mayusculas
      def mayusculas(str)
        return if str.nil?
        str
        .gsub(/[ÁÉÍÓÚÜáéíóúü]/, hash_vocales)
        .upcase
        .gsub(/ñ/, 'Ñ')
        .gsub(/,/, '')
        .gsub(/\./, '')
        .gsub(/'/, '')
      end

      def hash_vocales
        @hash_vocales ||= {'á' => 'a',
                           'é' => 'e',
                           'í' => 'i',
                           'ó' => 'o',
                           'ú' => 'u',
                           'ü' => 'u',
                           'Á' => 'A',
                           'É' => 'E',
                           'Í' => 'I',
                           'Ó' => 'O',
                           'Ú' => 'U',
                           'Ü' => 'U'}
      end
    end
  end
end

module Identificamex
  module Nombre

    module Mayusculas
      def mayusculas(str)
        return if str.nil?
        str
        .gsub(/[ÁÉÍÓÚÜáéíóúü]/, hash_vocales)
        .upcase
        .gsub(/ñ/, 'Ñ')
        .gsub(/,/, '')
        .gsub(/'/, '')
        .gsub(/\./, ' ')
        .squeeze(' ')
        .strip
      end

      def hash_vocales
        @hash_vocales ||= {'á' => 'a',
                           'é' => 'e',
                           'í' => 'i',
                           'ó' => 'o',
                           'ú' => 'u',
                           'ü' => 'u',
                           'Á' => 'A',
                           'É' => 'E',
                           'Í' => 'I',
                           'Ó' => 'O',
                           'Ú' => 'U',
                           'Ü' => 'U'}
      end
    end

  end
end

Replace dots with spaces and squeeze and strip the string.
Replace dots with spaces and squeeze and strip the string.
