<commit_before>require "quack/type"

module Quack
  module Types
    class Integer < Quack::Type
      PATTERN = /\A\d+\z/

      class << self
        def built_in_types
          @@built_in_types ||=
            [1.class, 10000000000000000000.class].uniq
        end

        def matches?(value)
          already_coerced?(value) || !!(value.to_s.strip =~ PATTERN)
        end
      end

      def to_coerced
        already_coerced? ? value : value.to_i
      end
    end
  end
end<commit_msg>better way to get type list<commit_after>require "quack/type"

module Quack
  module Types
    class Integer < Quack::Type
      PATTERN = /\A\d+\z/

      class << self
        def built_in_types
          @@built_in_types ||=
            ObjectSpace.each_object(Integer.singleton_class).to_a
        end

        def matches?(value)
          already_coerced?(value) || !!(value.to_s.strip =~ PATTERN)
        end
      end

      def to_coerced
        already_coerced? ? value : value.to_i
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09537856440511308, 'fraction_numerical': 0.02064896755162242, 'mean_word_length': 1.9169054441260744, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '2820556', 'n_tokens_mistral': 361, 'n_tokens_neox': 331, 'n_words': 73}