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: changelog_tag_finder.rb
    path of file: ./repos/gitlabhq/app/finders/repositories
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Repositories
  # A finder class for getting the tag of the last release before a given
  # version, used when generating changelogs.
  #
  # Imagine a project with the following tags:
  #
  # * v1.0.0
  # * v1.1.0
  # * v2.0.0
  #
  # If the version supplied is 2.1.0, the tag returned will be v2.0.0. And when
  # the version is 1.1.1, or 1.2.0, the returned tag will be v1.1.0.
  #
  # To obtain the tags, this finder requires a regular expr
    
    def extract_version(string, version_matcher)
      matches = version_matcher.match(string)

      return unless matches

      # When using this class for generating changelog data for a range of
      # commits, we want to compare against the tag of the last _stable_
      # release; not some random RC that came after that.
      return if matches[:pre]

      major = matches[:major]
      minor = matches[:minor]
      patch = matches[:patch]
      build = matches[:meta]

      return unless major && minor && patch

      version = "#{major}.#{minor}.#{patch}"
      version += "+#{build}" if build

      version
    end