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: require_tree.rb
    path of file: ./repos/path/lib/path
    
    the code of the file until where you have to start completion: class Path
  # @!group Requiring

  # Requires all .rb files recursively under +directory+
  # (or the current file's directory if not given).
  #
  # The order of requires is alphabetical,
  # but files having the same basename as a directory
  #
    
  def self.require_tree(directory = nil, options = {})
    directory, options = nil, directory if Hash === directory
    source = Path.file(caller)
    directory = Path.relative(directory || source.dir, caller)
    except = options[:except] || []

    directory.glob('**/*.rb').reject { |path|
      except.any? { |prefix| (path % directory).path.start_with?(prefix) }
    }.sort! { |a,b|
      if b.inside?(a.rm_ext)
        -1
      elsif a.inside?(b.rm_ext)
        +1
      else
        a <=> b
      end