Include a file: Difference between revisions

Line 688:
 
=={{header|Ruby}}==
Note that in Ruby, you don't use the file extension. Ruby will first check for a Ruby (.rb) file of the specified name and load it as a source file. If an .rb file is not found it will search for files in .so, .o, .dll or other shared-library formats and load them as Ruby extension. <lang Ruby>require</lang> will search in a series of pre-determined folders, while <lang Ruby>require_relative</lang> behaves the same way but searches in the current folder, or another specified folder.
Note that in Ruby, you don't use the file extension. .rb is assumed.
 
<lang Ruby>require 'file'</lang>
 
Anonymous user