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: widgets.rb
    path of file: ./repos/manageiq/lib/task_helpers/imports
    
    the code of the file until where you have to start completion: module TaskHelpers
  class Imports
    class Widgets
      def import(options = {})
        return unless options[:source]

        glob = File.file?(options[:source]) ? options[:source] : "#{options[:source]}/*.yaml"
        Dir.glob(glob) do |filename|
      
    
      def import(options = {})
        return unless options[:source]

        glob = File.file?(options[:source]) ? options[:source] : "#{options[:source]}/*.yaml"
        Dir.glob(glob) do |filename|
          $log.info("Importing Widgets from: #{filename}")

          widget_options = {:userid    => 'admin',
                             :overwrite => options[:overwrite],
                             :save      => true}

          begin
            widget_fd = File.open(filename, 'r')
            MiqWidget.import(widget_fd, widget_options)
          rescue ActiveModel::UnknownAttributeError, RuntimeError => err
            $log.error("Error importing #{filename} : #{err.message}")
            warn("Error importing #{filename} : #{err.message}")
          end
        end