<commit_before># frozen_string_literal: true
require 'resource_kit'

# TODO: Remove after `resource_kit` gem update.
ResourceKit::Action.class_eval do
  def handler(*response_codes, &block)
    if response_codes.empty?
      handlers[:any] = block
    else
      response_codes.each do |code|
        code = ResourceKit::StatusCodeMapper.code_for(code) unless code.is_a?(Integer)
        handlers[code] = block
      end
    end
  end
end

# TODO: Remove after `resource_kit` gem update.
ResourceKit::ResourceCollection.class_eval do
  def default_handler(*response_codes, &block)
    if response_codes.empty?
      default_handlers[:any] = block
    else
      response_codes.each do |code|
        code = ResourceKit::StatusCodeMapper.code_for(code) unless code.is_a?(Integer)
        default_handlers[code] = block
      end
    end
  end
end<commit_msg>Fix droplet_kit monkey patch.<commit_after># frozen_string_literal: true
require 'resource_kit'
require 'forwardable'

# TODO: Remove after `resource_kit` gem update.
module ResourceKit
  module ActionFix
    def handler(*response_codes, &block)
      if response_codes.empty?
        handlers[:any] = block
      else
        response_codes.each do |code|
          code = ResourceKit::StatusCodeMapper.code_for(code) unless code.is_a?(Integer)
          handlers[code] = block
        end
      end
    end
  end
  module ResourceCollectionFix
    def default_handler(*response_codes, &block)
      if response_codes.empty?
        default_handlers[:any] = block
      else
        response_codes.each do |code|
          code = ResourceKit::StatusCodeMapper.code_for(code) unless code.is_a?(Integer)
          default_handlers[code] = block
        end
      end
    end
  end
end
ResourceKit::Action.send(:prepend, ResourceKit::ActionFix)
ResourceKit::ResourceCollection.send(:prepend, ResourceKit::ResourceCollectionFix)
{'fraction_non_alphanumeric': 0.0871413390010627, 'fraction_numerical': 0.0, 'mean_word_length': 3.472684085510689, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1675069', 'n_tokens_mistral': 549, 'n_tokens_neox': 554, 'n_words': 131}