Sha256: 8a321259a821f45c1ab85898834bfc89a770cec466a0de57cbd6f5704af6b930

Contents?: true

Size: 592 Bytes

Versions: 12

Compression:

Stored size: 592 Bytes

Contents

module Clienteer
  module Sanitizer
    class Name

      def process(row)
        names = [row[:raw].first_name, row[:raw].last_name].compact
        if names.length == 1 && names[0].include?(" ")
          names = names[0].split(" ")
          row[:raw].first_name, row[:raw].last_name = *names
        end
        return row if names.all? {|n| proper? n }
        return remove(row)
      end

      def proper?(name)
        !name.match /\d/
      end

      def remove(row)
        row[:reason] = "names not valid"
        $skipped_people << row
        nil
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
clienteer-1.7.3 lib/clienteer/sanitizers/name.rb
clienteer-1.7.2 lib/clienteer/sanitizers/name.rb
clienteer-1.7.1 lib/clienteer/sanitizers/name.rb
clienteer-1.7.0 lib/clienteer/sanitizers/name.rb
clienteer-1.6.0 lib/clienteer/sanitizers/name.rb
clienteer-1.5.12 lib/clienteer/sanitizers/name.rb
clienteer-1.5.11 lib/clienteer/sanitizers/name.rb
clienteer-1.5.10 lib/clienteer/sanitizers/name.rb
clienteer-1.5.9 lib/clienteer/sanitizers/name.rb
clienteer-1.5.8 lib/clienteer/sanitizers/name.rb
clienteer-1.5.7 lib/clienteer/sanitizers/name.rb
clienteer-1.5.6 lib/clienteer/sanitizers/name.rb