るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

クラス

モジュール

キーワード

検索結果

Kernel.#throw(tag, value = nil) -> () (26131.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() # 絶対...

UncaughtThrowError (14030.0)

Kernel.#throw に指定した tag に対して一致する Kernel.#catch が存在しない場合に発生します。

...Kernel.#throw に指定した tag に対して一致する
Kernel.#catch が存在しない場合に発生します。

throw
"foo", "bar"
# => (例外発生) UncaughtThrowError: uncaught throw "foo"...

UncaughtThrowError#tag -> object (11024.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 (11024.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 (11014.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 (8048.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 (8048.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...

ThreadError (8008.0)

Thread 関連のエラーが起きたときに発生します。

...akeup あるいは Thread#run しようとしたとき
* スレッドが一つしかないのに Thread.stop しようとしたとき
* Kernel.#throw がスレッド内で Kernel.#catch されないとき
* スレッドから return しようとしたとき

* イテレータを与えずに...