コード例 #1
0
ファイル: load.c プロジェクト: Sophrinix/MacRuby
VALUE
rb_require(const char *fname)
{
    VALUE fn = rb_str_new2(fname);
    OBJ_FREEZE(fn);
    return rb_require_safe(fn, rb_safe_level());
}
コード例 #2
0
ファイル: load.c プロジェクト: scorpion007/ruby
/*
 * 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());
}
コード例 #3
0
ファイル: load.c プロジェクト: Sophrinix/MacRuby
VALUE
rb_f_require(VALUE obj, VALUE fname)
{
    return rb_require_safe(fname, rb_safe_level());
}
コード例 #4
0
ファイル: encoding.c プロジェクト: 217/ruby
static VALUE
require_enc(VALUE enclib)
{
    return rb_require_safe(enclib, rb_safe_level());
}
コード例 #5
0
ファイル: encoding.c プロジェクト: SongJungHwan/hwan
static VALUE
require_enc(VALUE enclib)
{
    int safe = rb_safe_level();
    return rb_require_safe(enclib, safe > 3 ? 3 : safe);
}
コード例 #6
0
ファイル: load.c プロジェクト: tenderlove/ruby
VALUE
rb_require(const char *fname)
{
    VALUE fn = rb_str_new_cstr(fname);
    return rb_require_safe(fn, rb_safe_level());
}