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: loader.rb
    path of file: ./repos/ohai/lib/ohai
    
    the code of the file until where you have to start completion: #
# Author:: Claire McQuin (<claire@chef.io>)
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require "chef-config/path_helper"
require_relative "log"
require_relative "mash"
require_relative "dsl"
require "pathname" unless defined?(Pathname)

module Ohai

  # Ohai plugin loader. Finds all the plugins specified in the
  # Ohai.config :plugin_path (supports a single or multiple path setting
  # here), evaluates them and returns plugin objects.
  class Loader
    attr_reader :logger

    def initialize(controller)
      @controller = controller
      @logger = controller.logger.with_child(subsystem: "loader")
      @v7_plugin_classes = []
    end

    # Searches all plugin paths and returns an Array of file paths to plugins
    #
    # @param dir [Array, String] directory/directories to load plugins from
    # @return [Array<String>]
    def plugin_file
    
    def plugin_files_by_dir(plugin_dir = Ohai.config[:plugin_path])
      Array(plugin_dir).map do |path|
        if Dir.exist?(path)
          Ohai::Log.trace("Searching for Ohai plugins in #{path}")

          escaped = ChefConfig::PathHelper.escape_glob_dir(path)
          Dir[File.join(escaped, "**", "*.rb")]
        else
          Ohai::Log.debug("The plugin path #{path} does not exist. Skipping...")
          []
        end
      end.flatten
    end

    # loads all plugin classes
    #
    # @return [Array<String>]
    def load_all
      plugin_files_by_dir.each do |plugin_file|
        load_plugin_class(plugin_file)
      end

      collect_v7_plugins
    end

    # load additional plugins classes from a given directory
    # @param from [String] path to a directory with additional plugins to load
    def load_additional(from)
      from = [ Ohai.config[:plugin_path], from].flatten
      plugin_files_by_dir(from).collect do |plugin_file|
        logger.trace "Loading additional plugin: #{plugin_file}"
        load_v7_plugin(load_plugin_class(plugin_file))
      end
    end

    # Load a specified file as an ohai plugin and creates an instance of it.
    # Not used by ohai itself, but is used in the specs to load plugins for testing
    #
    # @private
    # @param plugin_path [String]
    def load_plugin(plugin_path)
      plugin_class = load_plugin_class(plugin_path)
      return nil unless plugin_class.is_a?(Class)

      if plugin_class < Ohai::DSL::Plugin::VersionVII
        load_v7_plugin(plugin_class)
      else
        raise Exceptions::IllegalPluginDefinition, "cannot create plugin of type #{plugin_class}"
      end
    end