るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.023秒)

別のキーワード

  1. _builtin define_method
  2. main define_method
  3. module define_method
  4. rake define_task
  5. mutex_m define_aliases

検索結果

VALUE rb_catch(const char *tag, VALUE (*proc)(), VALUE data) (125.0)

catch と同等の動作を実行します。

...行します。

まず proc に、yield された値と data を渡して実行します。
その途中で tag が throw されたら rb_catch 全体を終了します。

throw が発生した場合はその値を返します。
throw が発生しなかったときは proc の返り値を返し...
...eld, INT2FIX(2));
}

static VALUE
foo_abort(VALUE obj)
{
return rb_throw("footag", Qnil);
}

void
Init_foo(void)
{
VALUE Foo = rb_define_class("Foo", rb_cObject);
rb_define_method(Foo, "catch", foo_catch, 0);
rb_define_method(Foo, "abort", foo_abort, 0);
}...
...ld, INT2FIX(2));
}

static VALUE
foo_abort(VALUE obj)
{
return rb_throw("footag", Qnil);
}

void
Init_foo(void)
{
VALUE Foo = rb_define_class("Foo", rb_cObject);
rb_define_method(Foo, "catch", foo_catch, 0);
rb_define_method(Foo, "abort", foo_abort, 0);
}...