種類
- モジュール関数 (33)
- 関数 (33)
- インスタンスメソッド (32)
- クラス (21)
- 文書 (21)
ライブラリ
- ビルトイン (84)
-
minitest
/ spec (1) -
minitest
/ unit (1)
クラス
- Object (1)
- UncaughtThrowError (30)
モジュール
- Kernel (33)
-
MiniTest
:: Assertions (1)
キーワード
-
NEWS for Ruby 2
. 2 . 0 (10) - Ruby用語集 (11)
- ThreadError (11)
- UncaughtThrowError (10)
-
assert
_ throws (1) - catch (22)
-
must
_ throw (1) -
rb
_ catch (11) -
rb
_ f _ throw (11) -
rb
_ throw (11) - tag (10)
-
to
_ s (10) - value (10)
検索結果
先頭5件
-
Kernel
. # throw(tag , value = nil) -> () (18129.0) -
Kernel.#catchとの組み合わせで大域脱出を行います。 throw は同じ tag を指定した catch のブロックの終わりまでジャンプします。
...Kernel.#catchとの組み合わせで大域脱出を行います。 throw
は同じ tag を指定した catch のブロックの終わりまでジャンプします。
throw は探索時に呼び出しスタックをさかのぼるので、
ジャンプ先は同じメソッド内にあるとは限......ります。
@raise ArgumentError 同じ tag で待っている catch が存在しない場合に発生します。
//emlist[例][ruby]{
def foo
throw :exit, 25
end
ret = catch(:exit) do
begin
foo
some_process() # 絶対に実行されない
10
ensure
puts "ensure"
end
e......ェクトです。
@param value catch の戻り値になります。
@raise UncaughtThrowError 同じ tag で待っている catch が存在しない場合に発生します。
//emlist[例][ruby]{
def foo
throw :exit, 25
end
ret = catch(:exit) do
begin
foo
some_process() # 絶対... -
MiniTest
:: Assertions # assert _ throws(tag , message = nil) { . . . } -> true (6134.0) -
与えられたブロックを評価中に、与えられたタグが Kernel.#throw された場合、検査にパスしたことになります。
...与えられたブロックを評価中に、与えられたタグが Kernel.#throw された場合、検査にパスしたことになります。
@param tag 与えられたブロック評価中に Kernel.#throw されるタグを任意のオブジェクトとして指定します。
@param mess......ージを指定します。
文字列か Proc を指定します。Proc である場合は Proc#call した
結果を使用します。
@raise MiniTest::Assertion 与えられたタグが Kernel.#throw されなかった場合に発生します。
@see Kernel.#throw... -
Object
# must _ throw(tag) -> true (6129.0) -
自身を評価中に、与えられたタグが Kernel.#throw された場合、検査にパスしたことになります。
...たタグが Kernel.#throw された場合、検査にパスしたことになります。
@param tag 自身を評価中に Kernel.#throw されるタグを任意のオブジェクトとして指定します。
@raise MiniTest::Assertion 与えられたタグが Kernel.#throw されなかった場......合に発生します。
@see MiniTest::Assertions#assert_throws... -
void rb
_ throw(const char *tag , VALUE val) (6116.0) -
throw の実体。返り値を val として、 tag を catch したところまでジャンプします。
...
throw の実体。返り値を val として、
tag を catch したところまでジャンプします。
rb_catch も参照してください。... -
static VALUE rb
_ f _ throw(int argc , VALUE *argv) (6100.0) -
-
UncaughtThrowError (6028.0)
-
Kernel.#throw に指定した tag に対して一致する Kernel.#catch が存在しない場合に発生します。
...Kernel.#throw に指定した tag に対して一致する
Kernel.#catch が存在しない場合に発生します。
throw "foo", "bar"
# => (例外発生) UncaughtThrowError: uncaught throw "foo"... -
UncaughtThrowError
# tag -> object (3022.0) -
Kernel.#throw に指定した tag を返します。
...Kernel.#throw に指定した tag を返します。
//emlist[例:][ruby]{
def do_complicated_things
throw :uncaught_label
end
begin
do_complicated_things
rescue UncaughtThrowError => ex
p ex.tag # => ":uncaught_label"
end
//}... -
UncaughtThrowError
# value -> object (3022.0) -
Kernel.#throw に指定した value を返します。
...Kernel.#throw に指定した value を返します。
//emlist[例][ruby]{
def do_complicated_things
throw :uncaught_label, "uncaught_value"
end
begin
do_complicated_things
rescue UncaughtThrowError => ex
p ex.value # => "uncaught_value"
end
//}... -
UncaughtThrowError
# to _ s -> String (3012.0) -
self を tag を含む文字列表現にして返します。
...self を tag を含む文字列表現にして返します。
//emlist[例][ruby]{
def do_complicated_things
throw :uncaught_label
end
begin
do_complicated_things
rescue UncaughtThrowError => ex
p ex.to_s # => "uncaught throw :uncaught_label"
end
//}... -
Kernel
. # catch {|tag| . . . . } -> object (46.0) -
Kernel.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。
...Kernel.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。
ブロックの実行中に tag と同一のオブジェクトを引数とする Kernel.#throw が行われた
場合は、その throw の第二引数を戻り値として、ブロック......@return ブロックの返り値か、対応するthrowの第二引数を返り値として返します。
//emlist[例][ruby]{
result = catch do |tag|
for i in 1..2
for j in 1..2
for k in 1..2
throw tag, k
end
end
end
end
p result #=> 1
//}
@see Kernel.#throw... -
Kernel
. # catch(tag) {|tag| . . . . } -> object (46.0) -
Kernel.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。
...Kernel.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。
ブロックの実行中に tag と同一のオブジェクトを引数とする Kernel.#throw が行われた
場合は、その throw の第二引数を戻り値として、ブロック......@return ブロックの返り値か、対応するthrowの第二引数を返り値として返します。
//emlist[例][ruby]{
result = catch do |tag|
for i in 1..2
for j in 1..2
for k in 1..2
throw tag, k
end
end
end
end
p result #=> 1
//}
@see Kernel.#throw... -
VALUE rb
_ catch(const char *tag , VALUE (*proc)() , VALUE data) (24.0) -
catch と同等の動作を実行します。
...oc に、yield された値と data を渡して実行します。
その途中で tag が throw されたら rb_catch 全体を終了します。
throw が発生した場合はその値を返します。
throw が発生しなかったときは proc の返り値を返します。
static VALUE......E
foo_catch(VALUE obj)
{
return rb_catch("footag", foo_yield, 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_c...