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: resource.rb
    path of file: ./repos/yt/lib/yt/models
    
    the code of the file until where you have to start completion: # encoding: UTF-8


    
      def patterns
        # @note: :channel *must* be the last since one of its regex eats the
        # remaining patterns. In short, don't change the following order.
        Enumerator.new do |patterns|
          VIDEO_PATTERNS.each {|regex| patterns << [:video, regex]}
          PLAYLIST_PATTERNS.each {|regex| patterns << [:playlist, regex]}
          CHANNEL_PATTERNS.each {|regex| patterns << [:channel, regex]}
        end
      end

      def fetch_channel_id
        response = Net::HTTP.start 'www.youtube.com', 443, use_ssl: true do |http|
          http.request Net::HTTP::Get.new("/#{@match['format']}#{@match['name']}")
        end
        if response.is_a?(Net::HTTPRedirection)
          response = Net::HTTP.start 'www.youtube.com', 443, use_ssl: true do |http|
            http.request Net::HTTP::Get.new(response['location'])
          end
        end
        regex = %r{<meta itemprop="channelId" content="(?<id>UC[a-zA-Z0-9_-]{22})">}
        if data = response.body.match(regex)
          data[:id]
        else
          raise Yt::Errors::NoItems
        end