<commit_before>module Dlibhydra
  # validates that there is a preflabel (authorities) or title (works etc.)
  # For FileSets, title and/or preflabel are optional
  class HasLabelValidator < ActiveModel::Validator
    def validate(record)
      if record.authority? and record.preflabel.nil?
        record.errors[:preflabel] << 'You must provide a preflabel for authorities'
      elsif !record.authority? and record.title.empty? and !record.fileset?
        record.errors[:title] << 'You must provide a title'
      end
    end
  end
end<commit_msg>use file_set? not fileset?<commit_after>module Dlibhydra
  # validates that there is a preflabel (authorities) or title (works etc.)
  # For FileSets, title and/or preflabel are optional
  class HasLabelValidator < ActiveModel::Validator
    def validate(record)
      if record.authority? and record.preflabel.nil?
        record.errors[:preflabel] << 'You must provide a preflabel for authorities'
      elsif !record.authority? and record.title.empty? and !record.file_set?
        record.errors[:title] << 'You must provide a title'
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08617594254937164, 'fraction_numerical': 0.0, 'mean_word_length': 3.6458333333333335, 'pattern_counts': {'":': 0, '<': 13, '<?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': '2972098', 'n_tokens_mistral': 326, 'n_tokens_neox': 323, 'n_words': 108}