Search code examples
rubymetasploit

Understanding require in Ruby


I was told when using require like below

require 'path1\path2'

Ruby will look for the specified file in $Load_Path($:).

But After I read the book Mastering Metasploit by Nipun Jaswal. And It says

...the require 'msf/core' statement is used to include a path for all the significant core libraries. These core libraries are located at the core directory under /lib/msf ...

The code mentioned in there looks like below.

require 'rex/proto/http'
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
  ...
end

In my understanding. The book says require msf/core will look for some files (not single file) to load.

I also read the manual.I didn't found any read says require to a path will load multiple files. Did I understand right ? Thanks.


Solution

  • require only loads a single file, but there's nothing stopping that file from loading other files, which is what is happening here.