You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: report_writer.rb
    path of file: ./repos/rspec-tracer/lib/rspec_tracer
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module RSpecTracer
  class ReportWriter
    def initialize(report_dir, reporter)
      @report_dir = report_dir
      @reporter = reporter
    end

    def write_report
      starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)

      @run_id = Digest::MD5.hexdigest(@reporter.all_examples.keys.sort.to_json)
      @cache_dir = F
    
    def write_report
      starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)

      @run_id = Digest::MD5.hexdigest(@reporter.all_examples.keys.sort.to_json)
      @cache_dir = File.join(@report_dir, @run_id)

      FileUtils.mkdir_p(@cache_dir)

      write_all_examples_report
      write_duplicate_examples_report
      write_interrupted_examples_report
      write_flaky_examples_report
      write_failed_examples_report
      write_pending_examples_report
      write_skipped_examples_report
      write_all_files_report
      write_dependency_report
      write_reverse_dependency_report
      write_examples_coverage_report
      write_last_run_report

      ending = Process.clock_gettime(Process::CLOCK_MONOTONIC)
      elapsed = RSpecTracer::TimeFormatter.format_time(ending - starting)

      RSpecTracer.logger.debug "RSpec tracer reports written to #{@cache_dir} (took #{elapsed})"
    end