<commit_before>module ActiveRecord
  module Type
    class Integer < Value # :nodoc:
      include Numeric

      def initialize(*)
        super
        @range = -max_value...max_value
      end

      def type
        :integer
      end

      def type_cast_from_database(value)
        return if value.nil?
        value.to_i
      end

      protected

      attr_reader :range

      private

      def cast_value(value)
        case value
        when true then 1
        when false then 0
        else
          result = value.to_i rescue nil
          ensure_in_range(result) if result
          result
        end
      end<commit_msg>Revert "[PERF] Speed up integer type casting from DB"<commit_after>module ActiveRecord
  module Type
    class Integer < Value # :nodoc:
      include Numeric

      def initialize(*)
        super
        @range = -max_value...max_value
      end

      def type
        :integer
      end

      alias type_cast_for_database type_cast

      protected

      attr_reader :range

      private

      def cast_value(value)
        case value
        when true then 1
        when false then 0
        else
          result = value.to_i rescue nil
          ensure_in_range(result) if result
          result
        end
      end
{'fraction_non_alphanumeric': 0.044740973312401885, 'fraction_numerical': 0.0031397174254317113, 'mean_word_length': 1.5551102204408818, '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': '4255272', 'n_tokens_mistral': 357, 'n_tokens_neox': 338, 'n_words': 111}