当前位置: 首页>>代码示例>>C++>>正文


C++ rb_attr_get函数代码示例

本文整理汇总了C++中rb_attr_get函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_attr_get函数的具体用法?C++ rb_attr_get怎么用?C++ rb_attr_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rb_attr_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: exc_to_s

static VALUE
exc_to_s(VALUE exc)
{
    VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));

    if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
    return rb_String(mesg);
}
开发者ID:brightbox,项目名称:deb-ruby2.1,代码行数:8,代码来源:error.c

示例2: exit_success_p

static VALUE
exit_success_p(VALUE exc)
{
    VALUE status = rb_attr_get(exc, rb_intern("status"));
    if (NIL_P(status)) return Qtrue;
    if (status == INT2FIX(EXIT_SUCCESS)) return Qtrue;
    return Qfalse;
}
开发者ID:tflynn,项目名称:ruby19-norubygems,代码行数:8,代码来源:error.c

示例3: exc_backtrace

static VALUE
exc_backtrace(VALUE exc)
{
    ID bt;

    CONST_ID(bt, "bt");
    return rb_attr_get(exc, bt);
}
开发者ID:nurse,项目名称:ruby,代码行数:8,代码来源:error.c

示例4: exc_backtrace

static VALUE
exc_backtrace(VALUE exc, SEL sel)
{
    static ID bt;

    if (!bt) bt = rb_intern("bt");
    return rb_attr_get(exc, bt);
}
开发者ID:JosephKu,项目名称:MacRuby,代码行数:8,代码来源:error.c

示例5: exc_to_s

static VALUE
exc_to_s(VALUE exc)
{
    VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));

    if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
    if (OBJ_TAINTED(exc)) OBJ_TAINT(mesg);
    return mesg;
}
开发者ID:technohippy,项目名称:oruby,代码行数:9,代码来源:error.c

示例6: name_err_to_s

static VALUE
name_err_to_s(VALUE exc)
{
    VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
    VALUE str = mesg;

    if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
    StringValue(str);
    return str;
}
开发者ID:Chatto,项目名称:VGdesk,代码行数:10,代码来源:error.c

示例7: exc_to_s

static VALUE
exc_to_s(VALUE exc)
{
    VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
    VALUE r = Qnil;

    if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
    r = rb_String(mesg);
    OBJ_INFECT(r, exc);
    return r;
}
开发者ID:evan,项目名称:ruby,代码行数:11,代码来源:error.c

示例8: exc_backtrace_locations

/*
 *  call-seq:
 *     exception.backtrace_locations    -> array
 *
 *  Returns any backtrace associated with the exception. This method is
 *  similar to Exception#backtrace, but the backtrace is an array of
 *   Thread::Backtrace::Location.
 *
 *  Now, this method is not affected by Exception#set_backtrace().
 */
static VALUE
exc_backtrace_locations(VALUE exc)
{
    VALUE obj;

    obj = rb_attr_get(exc, id_bt_locations);
    if (!NIL_P(obj)) {
	obj = rb_backtrace_to_location_ary(obj);
    }
    return obj;
}
开发者ID:0x00evil,项目名称:ruby,代码行数:21,代码来源:error.c

示例9: rb_mod_included_modules_nosuper

static void
rb_mod_included_modules_nosuper(VALUE mod, VALUE ary)
{
    VALUE inc_mods = rb_attr_get(mod, idIncludedModules);
    if (inc_mods != Qnil) {
	int i, count = RARRAY_LEN(inc_mods);
	for (i = 0; i < count; i++) {
	    VALUE imod = RARRAY_AT(inc_mods, i);
	    rb_ary_push(ary, imod);
	}
    }
}
开发者ID:Watson1978,项目名称:MacRuby,代码行数:12,代码来源:class.c

示例10: lazy_drop_while_func

static VALUE
lazy_drop_while_func(VALUE val, VALUE args, int argc, VALUE *argv)
{
    VALUE memo = rb_attr_get(argv[0], id_memo);
    if (NIL_P(memo) && !RTEST(rb_yield_values2(argc - 1, &argv[1]))) {
	rb_ivar_set(argv[0], id_memo, memo = Qtrue);
    }
    if (memo == Qtrue) {
	rb_funcall2(argv[0], id_yield, argc - 1, argv + 1);
    }
    return Qnil;
}
开发者ID:takuto-h,项目名称:ruby,代码行数:12,代码来源:enumerator.c

示例11: append_method

static VALUE
append_method(VALUE obj, VALUE str, ID default_method, VALUE default_args)
{
    VALUE method, eargs;

    method = rb_attr_get(obj, id_method);
    if (method != Qfalse) {
	ID mid = default_method;
	if (!NIL_P(method)) {
	    Check_Type(method, T_SYMBOL);
	    mid = SYM2ID(method);
	}
	rb_str_buf_cat2(str, ":");
	rb_str_buf_append(str, rb_id2str(mid));
    }

    eargs = rb_attr_get(obj, id_arguments);
    if (NIL_P(eargs)) {
	eargs = default_args;
    }
    if (eargs != Qfalse) {
	long   argc = RARRAY_LEN(eargs);
	VALUE *argv = RARRAY_PTR(eargs);

	if (argc > 0) {
	    rb_str_buf_cat2(str, "(");

	    while (argc--) {
		VALUE arg = *argv++;

		rb_str_append(str, rb_inspect(arg));
		rb_str_buf_cat2(str, argc > 0 ? ", " : ")");
		OBJ_INFECT(str, arg);
	    }
	}
    }

    return str;
}
开发者ID:takuto-h,项目名称:ruby,代码行数:39,代码来源:enumerator.c

示例12: name_err_to_s

static VALUE
name_err_to_s(VALUE exc)
{
    VALUE mesg = rb_attr_get(exc, rb_intern("mesg")), str = mesg;

    if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
    StringValue(str);
    if (str != mesg) {
	rb_iv_set(exc, "mesg", mesg = str);
    }
    if (OBJ_TAINTED(exc)) OBJ_TAINT(mesg);
    return mesg;
}
开发者ID:asimoov,项目名称:emscripted-ruby,代码行数:13,代码来源:error.c

示例13: exc_backtrace_locations

/*
 *  call-seq:
 *     exception.backtrace_locations    -> array
 *
 *  Returns any backtrace associated with the exception. This method is
 *  similar to Exception#backtrace, but the backtrace is an array of
 *   Thread::Backtrace::Location.
 *
 *  Now, this method is not affected by Exception#set_backtrace().
 */
static VALUE
exc_backtrace_locations(VALUE exc)
{
    ID bt_locations;
    VALUE obj;

    CONST_ID(bt_locations, "bt_locations");
    obj = rb_attr_get(exc, bt_locations);
    if (!NIL_P(obj)) {
	obj = rb_backtrace_to_location_ary(obj);
    }
    return obj;
}
开发者ID:knugie,项目名称:ruby,代码行数:23,代码来源:error.c

示例14: rb_mod_ancestors_nocopy

VALUE
rb_mod_ancestors_nocopy(VALUE mod)
{
    VALUE ary = rb_attr_get(mod, idAncestors);
    if (NIL_P(ary)) {
	ary = rb_ary_new();
	for (VALUE p = mod; p != 0; p = RCLASS_SUPER(p)) {
	    rb_ary_push(ary, p);
	    rb_mod_included_modules_nosuper(p, ary);
	}
	rb_ivar_set(mod, idAncestors, ary);	
    }
    return ary;
}
开发者ID:MSch,项目名称:MacRuby,代码行数:14,代码来源:class.c

示例15: exit_success_p

static VALUE
exit_success_p(VALUE exc)
{
    VALUE status_val = rb_attr_get(exc, rb_intern("status"));
    int status;

    if (NIL_P(status_val))
	return Qtrue;
    status = NUM2INT(status_val);
    if (WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS)
	return Qtrue;

    return Qfalse;
}
开发者ID:knugie,项目名称:ruby,代码行数:14,代码来源:error.c


注:本文中的rb_attr_get函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。