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/stackneveroverflow/vendor/bundle/ruby/2.3.0/gems/rake-12.0.0/lib/rake/ext
    
    the code of the file until where you have to start completion: require "rake/ext/core"

class String

  rake_extension("ext") do
    # Replace the file extension with +newext+.  If there is no extension on
    # the st
    
    def pathmap_partial(n)
      dirs = File.dirname(self).pathmap_explode
      partial_dirs =
        if n > 0
          dirs[0...n]
        elsif n < 0
          dirs.reverse[0...-n].reverse
        else
          "."
        end