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: result.rb
    path of file: ./repos/mongo-ruby-driver/lib/mongo/srv
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
# rubocop:todo all

# Copyright (C) 2017-2020 MongoDB Inc.
#
# Licensed 
    
      def validate_same_origin!(record_host)
        domain_name ||= query_hostname.split('.')[1..-1]
        host_parts = record_host.split('.')

        unless (host_parts.size > domain_name.size) && (domain_name == host_parts[-domain_name.length..-1])
          raise Error::MismatchedDomain.new(MISMATCHED_DOMAINNAME % [record_host, domain_name])
        end
      end
    end