<commit_before>class Object
  def safe_meta_def method_name, &block
    metaclass.remember_original_method(method_name)
    meta_eval { define_method method_name, &block }
  end

  def reset(method_name)
    metaclass.restore_original_method(method_name)
  end

  protected

  def remember_original_method(method_name)
    alias_method "__original_#{method_name}".to_sym, method_name if method_defined?(method_name)<commit_msg>Apply the same fix in SHA: 61457e1c1b to safe_meta_def<commit_after>class Object
  def safe_meta_def method_name, &block
    metaclass.remember_original_method(method_name)
    meta_eval {
      define_method(method_name) {|*args, &block|
        method_body.call(*args, &block)
      }
    }
  end

  def reset(method_name)
    metaclass.restore_original_method(method_name)
  end

  protected

  def remember_original_method(method_name)
    alias_method "__original_#{method_name}".to_sym, method_name if method_defined?(method_name)
{'fraction_non_alphanumeric': 0.07476635514018691, 'fraction_numerical': 0.007268951194184839, 'mean_word_length': 5.219354838709678, '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': '4367174', 'n_tokens_mistral': 325, 'n_tokens_neox': 317, 'n_words': 57}