Ruby Language Loading Source Files Automatically loading source files

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

The method Kernel#autoload registers filename to be loaded (using Kernel::require) the first time that module (which may be a String or a symbol) is accessed.

autoload :MyModule, '/usr/local/lib/modules/my_module.rb' 

The method Kernel#autoload? returns filename to be loaded if name is registered as autoload.

autoload? :MyModule  #=> '/usr/local/lib/modules/my_module.rb'


Got any Ruby Language Question?