<commit_before>module OmgValidator
  module Validators
    # Checks whether input is a valid IP Address
    #
    # validates :ip_address, ip_adress: true
    class IpAddressValidator < ActiveModel::EachValidator
      def validate_each(record, attribute, value)
        return nil if value.nil?
        reg = '/\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/'
        unless reg.match(value)
          record.errors[attribute] = "must be a valid IP address"
        end
      end
    end
  end
end

ActiveModel::Validations::IpAddressValidator = OmgValidator::Validators::IpAddressValidator<commit_msg>replaced regex for ip address validator<commit_after>module OmgValidator
  module Validators
    # Checks whether input is a valid IP Address
    #
    # validates :ip_address, ip_adress: true
    class IpAddressValidator < ActiveModel::EachValidator
      def validate_each(record, attribute, value)
        return nil if value.nil?
        reg = /^\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$\b/
        unless reg.match(value)
          record.errors[attribute] = "must be a valid IP address"
        end
      end
    end
  end
end

ActiveModel::Validations::IpAddressValidator = OmgValidator::Validators::IpAddressValidator
{'fraction_non_alphanumeric': 0.15233785822021115, 'fraction_numerical': 0.04675716440422323, 'mean_word_length': 3.3651315789473686, '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': '1211706', 'n_tokens_mistral': 472, 'n_tokens_neox': 463, 'n_words': 94}