<commit_before>class Module
    def with_replacement_methods(hash)
      old_pairs = hash.collect do | key, value |
        old_method = instance_method(key)
        define_method(key, value)      
        [key, old_method]
      end
      yield
    ensure
      old_pairs.each { | pair | define_method(*pair) }
    end
end

module Stunted

  class FunctionalHash
    def self.with_replacement_methods(hash)
      old_pairs = hash.collect do | key, value |
        old_method = instance_method(key)
        define_method(key, value)      
        [key, old_method]
      end
      yield
    ensure
      old_pairs.each { | pair | define_method(*pair) }
    end

    def with_replacement_methods(hash, &block)
      self.class.with_replacement_methods(hash, &block)
    end

  end
end<commit_msg>Remove mocking function from FunctionalHash<commit_after>class Module
    def with_replacement_methods(hash)
      old_pairs = hash.collect do | key, value |
        old_method = instance_method(key)
        define_method(key, value)      
        [key, old_method]
      end
      yield
    ensure
      old_pairs.each { | pair | define_method(*pair) }
    end
end

module Stunted

  class FunctionalHash
    def with_replacement_methods(hash, &block)
      self.class.with_replacement_methods(hash, &block)
    end
  end
end
{'fraction_non_alphanumeric': 0.07494322482967448, 'fraction_numerical': 0.0, 'mean_word_length': 2.592391304347826, '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': '6053918', 'n_tokens_mistral': 415, 'n_tokens_neox': 406, 'n_words': 93}