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: formatter.rb
    path of file: ./repos/ruby/lib/random
    
    the code of the file until where you have to start completion: # -*- coding: us-ascii -*-
# frozen_string_literal: true

# == \Random number formatter.
#
# Formats generated random numbers in many manners. When <tt>'random/formatter'</tt>
# is required, several methods are added to empty core module <tt>Random::Formatter</tt>,
# making them available as Random's instance and module methods.
#
# Standard library SecureRandom is also extended with the mo
    
  def uuid_v7(extra_timestamp_bits: 0)
    case (extra_timestamp_bits = Integer(extra_timestamp_bits))
    when 0 # min timestamp precision
      ms = Process.clock_gettime(Process::CLOCK_REALTIME, :millisecond)
      rand = random_bytes(10)
      rand.setbyte(0, rand.getbyte(0) & 0x0f | 0x70) # version
      rand.setbyte(2, rand.getbyte(2) & 0x3f | 0x80) # variant
      "%08x-%04x-%s" % [
        (ms & 0x0000_ffff_ffff_0000) >> 16,
        (ms & 0x0000_0000_0000_ffff),
        rand.unpack("H4H4H12").join("-")
      ]

    when 12 # max timestamp precision
      ms, ns = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond)
        .divmod(1_000_000)
      extra_bits = ns * 4096 / 1_000_000
      rand = random_bytes(8)
      rand.setbyte(0, rand.getbyte(0) & 0x3f | 0x80) # variant
      "%08x-%04x-7%03x-%s" % [
        (ms & 0x0000_ffff_ffff_0000) >> 16,
        (ms & 0x0000_0000_0000_ffff),
        extra_bits,
        rand.unpack("H4H12").join("-")
      ]

    when (0..12) # the generic version is slower than the special cases above
      rand_a, rand_b1, rand_b2, rand_b3 = random_bytes(10).unpack("nnnN")
      rand_mask_bits = 12 - extra_timestamp_bits
      ms, ns = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond)
        .divmod(1_000_000)
      "%08x-%04x-%04x-%04x-%04x%08x" % [
        (ms & 0x0000_ffff_ffff_0000) >> 16,
        (ms & 0x0000_0000_0000_ffff),
        0x7000 |
          ((ns * (1 << extra_timestamp_bits) / 1_000_000) << rand_mask_bits) |
          rand_a & ((1 << rand_mask_bits) - 1),
        0x8000 | (rand_b1 & 0x3fff),
        rand_b2,
        rand_b3
      ]

    else
      raise ArgumentError, "extra_timestamp_bits must be in 0..12"
    end