Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the paths that "require" looks up by default?

Tags:

ruby

require

In Ruby, I have been told that when doing

require "some_file" 

Ruby will look for the file in certain places.

I know that it looks for some_file.rb, but where does it look for it by default?

like image 949
Mark Provan Avatar asked Feb 27 '12 23:02

Mark Provan


1 Answers

It depends on your platform, and how Ruby was compiled, so there is no "the" answer to this. You can find out by running:

ruby -e 'puts $:' 

Generally, though, you have the standard, site, and vendor Ruby library paths, including an arch, version, and general directory under each.

like image 109
Daniel Pittman Avatar answered Oct 12 '22 16:10

Daniel Pittman