<commit_before>class PhoneValidator < ActiveModel::EachValidator

  def validate_each(record, attribute, value)
    return if !value
    unless value =~ /\A((\+? ?1)([- \.]?))?((\( ?([2-9][0-8]\d) ?\))|([2-9][0-8]\d))([- \.]?)?([2-9]((0\d)|(1[02-9])|([2-9]\d)))([- \.]?)?(\d{4})( ?(x\.?| |\.|(ext\.?)|extension|ex\.?) ?(\d+))?\z/i
      record.errors.add(attribute, options[:message] || :invalid)
    end
    
  end

end<commit_msg>Ignore whitespace on either ends of the phone number<commit_after>class PhoneValidator < ActiveModel::EachValidator

  def validate_each(record, attribute, value)
    return if !value
    unless value.strip =~ /\A((\+? ?1)([- \.]?))?((\( ?([2-9][0-8]\d) ?\))|([2-9][0-8]\d))([- \.]?)?([2-9]((0\d)|(1[02-9])|([2-9]\d)))([- \.]?)?(\d{4})( ?(x\.?| |\.|(ext\.?)|extension|ex\.?) ?(\d+))?\z/i
      record.errors.add(attribute, options[:message] || :invalid)
    end
    
  end

end
{'fraction_non_alphanumeric': 0.32893289328932895, 'fraction_numerical': 0.041804180418041806, 'mean_word_length': 3.4174757281553396, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6306910', 'n_tokens_mistral': 398, 'n_tokens_neox': 379, 'n_words': 61}