VALUE rb_require(const char *fname) { VALUE fn = rb_str_new2(fname); OBJ_FREEZE(fn); return rb_require_safe(fn, rb_safe_level()); }
/* * call-seq: * require_relative(string) -> true or false * * Ruby tries to load the library named _string_ relative to the requiring * file's path. If the file's path cannot be determined a LoadError is raised. * If a file is loaded +true+ is returned and false otherwise. */ VALUE rb_f_require_relative(VALUE obj, VALUE fname) { VALUE base = rb_current_realfilepath(); if (NIL_P(base)) { rb_loaderror("cannot infer basepath"); } base = rb_file_dirname(base); return rb_require_safe(rb_file_absolute_path(fname, base), rb_safe_level()); }
VALUE rb_f_require(VALUE obj, VALUE fname) { return rb_require_safe(fname, rb_safe_level()); }
static VALUE require_enc(VALUE enclib) { return rb_require_safe(enclib, rb_safe_level()); }
static VALUE require_enc(VALUE enclib) { int safe = rb_safe_level(); return rb_require_safe(enclib, safe > 3 ? 3 : safe); }
VALUE rb_require(const char *fname) { VALUE fn = rb_str_new_cstr(fname); return rb_require_safe(fn, rb_safe_level()); }