Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Kernel#require_relative
(::String feature) -> bool
require_relative(string) → true or false
load.c
View on GitHub ↗
static VALUE
rb_f_require_relative(VALUE obj, VALUE fname)
{
return rb_require_relative_entrypoint(fname);
}
Ruby tries to load the library named string relative to the directory containing the requiring file. If the file does not exist a LoadError is raised. Returns true if the file was loaded and false if the file was already loaded before.