<commit_before>module Json2

  # Turn a Json input into a Csv output without header.
  class CsvWithoutHeader

    def initialize(input)
      @input = input
      @names_stack = []
      @output = ''
      process_input
    end

    attr_reader :output

    private

    def process_input
      if @input.respond_to?(:each_key)
        process_keys(@input)
      else
        process_array(@input)
      end
    end

    def process_keys(object)
      if object.respond_to?(:each_key)
        object.each_key do |key|
          @names_stack.push(key)
          process_key(object[key])
          @names_stack.pop
        end
      else
        record_line(object)
      end
    end

    def process_key(object)
      case object
      when ~:each_key then process_keys(object)<commit_msg>Remove dead code<commit_after>module Json2

  # Turn a Json input into a Csv output without header.
  class CsvWithoutHeader

    def initialize(input)
      @input = input
      @names_stack = []
      @output = ''
      process_input
    end

    attr_reader :output

    private

    def process_input
      process_keys(@input)
    end

    def process_keys(object)
      if object.respond_to?(:each_key)
        object.each_key do |key|
          @names_stack.push(key)
          process_key(object[key])
          @names_stack.pop
        end
      else
        record_line(object)
      end
    end

    def process_key(object)
      case object
      when ~:each_key then process_keys(object)
{'fraction_non_alphanumeric': 0.07186030893216924, 'fraction_numerical': 0.001343183344526528, 'mean_word_length': 2.0848861283643894, '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': '3079957', 'n_tokens_mistral': 458, 'n_tokens_neox': 442, 'n_words': 110}