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: restart_dnsmasq.rb
    path of file: ./repos/landrush/lib/landrush/cap/host/redhat
    
    the code of the file until where you have to start completion: require_relative '../../../util/dnsmasq'

module Landrush
  module Cap
    module Redhat
      module RestartDnsmasq
        class << self
          SED_COMMAND = <<-EOF.gsub(/^ +/, '')
          sudo sed -i.orig '1 i\
          # Added by landrush, a vagr
    
          def restart_dnsmasq(_env)
            # TODO: At some stage we might want to make create_dnsmasq_config host specific and add the resolv.conf
            # changes there which seems more natural
            if Landrush::Util::Dnsmasq.nm_managed?
              system('sudo systemctl reload NetworkManager')
            else
              system(SED_COMMAND) unless system("cat /etc/resolv.conf | grep 'nameserver 127.0.0.1' > /dev/null 2>&1")
              system('sudo systemctl restart dnsmasq')
            end