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

module Leftovers
  module MatcherBuilders
    module StringPattern
      def self.build(match: nil, has_prefix: nil, has_suffix: nil) # rubocop:disable Metrics
        has_prefix = ::Regexp.escape(has_prefix) if has_prefix
        has_suffix = ::Regexp.escape(has_suffix) if has_suffix

        if match && has_prefix && has_suffix
          /\A(?=#{match}\z)(?=#{has_prefix}).*#{has_suffix}\z/
        elsif match && has_prefix
          /\A(?=#{match}\z)#{has_prefix}/
        elsif match && has_suffix
          /\A(?=#{match}\z).*#{has_suffix}\z/
        elsif match
          /\A#{match}\z/
        elsif has_prefix && has_suffix
    
    
      def self.build(match: nil, has_prefix: nil, has_suffix: nil) # rubocop:disable Metrics
        has_prefix = ::Regexp.escape(has_prefix) if has_prefix
        has_suffix = ::Regexp.escape(has_suffix) if has_suffix

        if match && has_prefix && has_suffix
          /\A(?=#{match}\z)(?=#{has_prefix}).*#{has_suffix}\z/
        elsif match && has_prefix
          /\A(?=#{match}\z)#{has_prefix}/
        elsif match && has_suffix
          /\A(?=#{match}\z).*#{has_suffix}\z/
        elsif match
          /\A#{match}\z/
        elsif has_prefix && has_suffix
          /\A(?=#{has_prefix}).*#{has_suffix}\z/
        elsif has_prefix
          /\A#{has_prefix}/
        elsif has_suffix
          /#{has_suffix}\z/
        else
          nil
        end