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: string.rb
    path of file: ./repos/faker/lib/faker/default
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Faker
  class String < Base
    class << self
      ##
      # Produces a random UTF-8 string with optional nested length selectors.
      #
      # @param length [Integer, Range, Array<Integer, Range, nil>] The length of produced string and/or specific UTF-8 characters to use.
      # @return [String]
      #
      # @example
      #   Fak
    
      def utf8string(length)
        ratio = char_space_ratio
        (1..length.to_i).map do
          space_or_utf8_char ratio
        end.join
      end

      def space_or_utf8_char(ratio)
        sample [32.chr(Encoding::UTF_8), [utf8character] * ratio].flatten
      end

      def char_space_ratio
        sample [2, [3] * 5, [5] * 17, [7] * 11, 11, 191].flatten
      end

      def utf8character
        sample([
                 rand(32..90),           # latin alphabet
                 rand(128),              # 7-bit ASCII
                 rand(0xd800),           # utf-8 codepoints below utf-16 surrogate halves
                 rand(57_344..1_114_111) # utf-8 codepoints above utf-16 surrogate halves
               ]).chr(Encoding::UTF_8)
      end
    end