<commit_before>module RiotSetBuilder
  class Item
    attr_accessor :id, :count

    DEFAULT_OPTIONS = {
      count: 1
    }

    def initialize(options = {})
      options = DEFAULT_OPTIONS.merge(options)

      @id = options[:id]
      @count = options[:count]

      verify_attributes
    end

    def verify_attributes
      raise "Item requires an ID" unless id
      raise "Item's count must be a number >= 0"  unless count >= 0
    end
  end
end<commit_msg>Add custom errors to item validation<commit_after>require 'riot_set_builder/errors'

module RiotSetBuilder
  class Item
    include Error::Item

    attr_accessor :id, :count

    DEFAULT_OPTIONS = {
      count: 1
    }

    def initialize(options = {})
      options = DEFAULT_OPTIONS.merge(options)

      @id = options[:id]
      @count = options[:count]

      verify_attributes
    end

    def verify_attributes
      raise NoID, "Item requires an ID" unless id
      raise InvalidCount, "Item's count must be a number >= 0"  unless count >= 0
    end
  end
end
{'fraction_non_alphanumeric': 0.0803484995159729, 'fraction_numerical': 0.005808325266214908, 'mean_word_length': 2.6280701754385967, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6859879', 'n_tokens_mistral': 320, 'n_tokens_neox': 301, 'n_words': 96}