<commit_before>class Hash
  
  # Methodize this hash
  def methodize!(recursive = true)
    self.extend(Methodize)
    if recursive
      self.values.each do |val|
        case val
        when Hash
          val.methodize!(recursive)
        when Array
          val.methodize_hashes!(recursive)
        end
      end
    end
  end
  
  # Makes a fully recursive merge
  def noe_merge(right)
    self.merge(right) do |key,oldval,newval|
      unless oldval.class == newval.class
        raise Noe::Error, "Conflict on #{key} has to be resolved manually, sorry.\n"\
                          "#{oldval} (#{oldval.class}) vs. #{newval} (#{newval.class})"
      end
      if oldval.respond_to?(:noe_merge)
        oldval.noe_merge(newval)
      else
        newval
      end<commit_msg>Allowed oldval to be nil in YAML merging<commit_after>class Hash
  
  # Methodize this hash
  def methodize!(recursive = true)
    self.extend(Methodize)
    if recursive
      self.values.each do |val|
        case val
        when Hash
          val.methodize!(recursive)
        when Array
          val.methodize_hashes!(recursive)
        end
      end
    end
  end
  
  # Makes a fully recursive merge
  def noe_merge(right)
    self.merge(right) do |key,oldval,newval|
      if oldval.nil?
        newval
      elsif oldval.class != newval.class
        raise Noe::Error, "Conflict on #{key} has to be resolved manually, sorry.\n"\
                          "#{oldval} (#{oldval.class}) vs. #{newval} (#{newval.class})"
      elsif oldval.respond_to?(:noe_merge)
        oldval.noe_merge(newval)
      else
        newval
      end
{'fraction_non_alphanumeric': 0.0973505853357979, 'fraction_numerical': 0.0, 'mean_word_length': 2.0469043151969983, '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': '5282505', 'n_tokens_mistral': 529, 'n_tokens_neox': 515, 'n_words': 132}