Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Kernel#autoload

autoload(module, filename) → nil

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

Example
autoload(:MyModule, "/usr/local/lib/modules/my_module.rb")
See also #autoload? #at_exit #Array #BigDecimal also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0