• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ rb_attr_get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: exc_backtrace

static VALUE
exc_backtrace(VALUE exc)
{
    VALUE obj;

    obj = rb_attr_get(exc, id_bt);

    if (rb_backtrace_p(obj)) {
	obj = rb_backtrace_to_str_ary(obj);
	/* rb_ivar_set(exc, id_bt, obj); */
    }

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


示例17: exc_equal

static VALUE
exc_equal(VALUE exc, VALUE obj)
{
    VALUE mesg, backtrace;
    ID id_mesg;

    if (exc == obj) return Qtrue;
    CONST_ID(id_mesg, "mesg");

    if (rb_obj_class(exc) != rb_obj_class(obj)) {
	int status = 0;
	ID id_message, id_backtrace;
	CONST_ID(id_message, "message");
	CONST_ID(id_backtrace, "backtrace");

	obj = rb_protect(try_convert_to_exception, obj, &status);
	if (status || obj == Qundef) {
	    rb_set_errinfo(Qnil);
	    return Qfalse;
	}
	if (rb_obj_class(exc) != rb_obj_class(obj)) return Qfalse;
	mesg = rb_check_funcall(obj, id_message, 0, 0);
	if (mesg == Qundef) return Qfalse;
	backtrace = rb_check_funcall(obj, id_backtrace, 0, 0);
	if (backtrace == Qundef) return Qfalse;
    }
    else {
	mesg = rb_attr_get(obj, id_mesg);
	backtrace = exc_backtrace(obj);
    }

    if (!rb_equal(rb_attr_get(exc, id_mesg), mesg))
	return Qfalse;
    if (!rb_equal(exc_backtrace(exc), backtrace))
	return Qfalse;
    return Qtrue;
}
开发者ID:brightbox,项目名称:deb-ruby2.1,代码行数:37,代码来源:error.c


示例18: lazy_drop_func

static VALUE
lazy_drop_func(VALUE val, VALUE args, int argc, VALUE *argv)
{
    long remain;
    VALUE memo = rb_attr_get(argv[0], id_memo);
    if (NIL_P(memo)) {
	memo = args;
    }
    if ((remain = NUM2LONG(memo)) == 0) {
	rb_funcall2(argv[0], id_yield, argc - 1, argv + 1);
    }
    else {
	rb_ivar_set(argv[0], id_memo, LONG2NUM(--remain));
    }
    return Qnil;
}
开发者ID:takuto-h,项目名称:ruby,代码行数:16,代码来源:enumerator.c


示例19: exc_backtrace

static VALUE
exc_backtrace(VALUE exc)
{
    ID bt;
    VALUE obj;

    CONST_ID(bt, "bt");
    obj = rb_attr_get(exc, bt);

    if (rb_backtrace_p(obj)) {
	obj = rb_backtrace_to_str_ary(obj);
	/* rb_iv_set(exc, "bt", obj); */
    }

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


示例20: syserr_eqq

static VALUE
syserr_eqq(VALUE self, VALUE exc)
{
    VALUE num, e;

    if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) {
	if (!rb_respond_to(exc, id_errno)) return Qfalse;
    }
    else if (self == rb_eSystemCallError) return Qtrue;

    num = rb_attr_get(exc, id_errno);
    if (NIL_P(num)) {
	num = rb_funcallv(exc, id_errno, 0, 0);
    }
    e = rb_const_get(self, id_Errno);
    if (FIXNUM_P(num) ? num == e : rb_equal(num, e))
	return Qtrue;
    return Qfalse;
}
开发者ID:0x00evil,项目名称:ruby,代码行数:19,代码来源:error.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rb_block_call函数代码示例发布时间:2022-05-30
下一篇:
C++ rb_ary_store函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap