143件ヒット
[1-100件を表示]
(0.119秒)
ライブラリ
- ビルトイン (66)
クラス
モジュール
- Kernel (33)
キーワード
- Ruby用語集 (11)
-
catch
_ i (11) -
catch
_ timer (11) - debug (11)
- disasm (11)
- disassemble (11)
- optparse (11)
-
rb
_ f _ catch (11) -
rb
_ throw (11) - throw (11)
-
to
_ a (11)
検索結果
先頭5件
-
Kernel
. # catch {|tag| . . . . } -> object (18130.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 (18130.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... -
static VALUE catch
_ i(ID tag) (12200.0) -
-
static void catch
_ timer(int sig) (12200.0) -
-
static VALUE rb
_ f _ catch(VALUE dmy , VALUE tag) (6200.0) -
-
RubyVM
:: InstructionSequence . disasm(body) -> String (6118.0) -
引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字 列に変換して返します。
...::InstructionSequence オブジェクトを人間が読める形式の文字
列に変換して返します。
@param body Proc、Method オブジェクトを指定します。
例1:Proc オブジェクトを指定した場合
# /tmp/proc.rb
p = proc { num = 1 + 2 }
puts RubyVM::Instruction......Sequence.disasm(p)
出力:
== disasm: <RubyVM::InstructionSequence:block in <main>@/tmp/proc.rb>===
== catch table
| catch type: redo st: 0000 ed: 0012 sp: 0000 cont: 0000
| catch type: next st: 0000 ed: 0012 sp: 0000 cont: 0012
|------------------------------------------------------......------------------
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1)
[ 2] num
0000 trace 1 ( 1)
0002 putobject 1
0004 putobject 2
0006 opt_plus <ic:1>
0008 dup
0009 setlocal... -
RubyVM
:: InstructionSequence . disassemble(body) -> String (6118.0) -
引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字 列に変換して返します。
...::InstructionSequence オブジェクトを人間が読める形式の文字
列に変換して返します。
@param body Proc、Method オブジェクトを指定します。
例1:Proc オブジェクトを指定した場合
# /tmp/proc.rb
p = proc { num = 1 + 2 }
puts RubyVM::Instruction......Sequence.disasm(p)
出力:
== disasm: <RubyVM::InstructionSequence:block in <main>@/tmp/proc.rb>===
== catch table
| catch type: redo st: 0000 ed: 0012 sp: 0000 cont: 0000
| catch type: next st: 0000 ed: 0012 sp: 0000 cont: 0012
|------------------------------------------------------......------------------
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1)
[ 2] num
0000 trace 1 ( 1)
0002 putobject 1
0004 putobject 2
0006 opt_plus <ic:1>
0008 dup
0009 setlocal... -
RubyVM
:: InstructionSequence # to _ a -> Array (3006.0) -
self の情報を 14 要素の配列にして返します。
...ンスを以下の情報で表します。
: magic
データフォーマットを示す文字列。常に
"YARVInstructionSequence/SimpleDataFormat"。
: major_version
命令シーケンスのメジャーバージョン。
: minor_version
命令シーケンスのマイナーバージ......ータフォーマットを示す数値。常に 1。
: misc
以下の要素から構成される Hash オブジェクト。
:arg_size: メソッド、ブロックが取る引数の総数(1 つもない場合は 0)。
:local_size: ローカル変数の総数 + 1。
:stack_max: ス......あるいは以下のよう
な配列。
[required_argc, [optional_arg_labels, ...],
splat_index, post_splat_argc, post_splat_index,
block_index, simple]
より詳細な情報については、vm_core.h を参照。
: catch_table
例外や制御構造のオペレータ(rescue... -
Kernel
. # throw(tag , value = nil) -> () (168.0) -
Kernel.#catchとの組み合わせで大域脱出を行います。 throw は同じ tag を指定した catch のブロックの終わりまでジャンプします。
...Kernel.#catchとの組み合わせで大域脱出を行います。 throw
は同じ tag を指定した catch のブロックの終わりまでジャンプします。
throw は探索時に呼び出しスタックをさかのぼるので、
ジャンプ先は同じメソッド内にあるとは限......待っている catch が存在しない場合は、例外で
スレッドが終了します。
同じ tag であるとは Object#object_id が同じであるという意味です。
@param tag catch の引数に対応する任意のオブジェクトです。
@param value catch の戻り値にな......ります。
@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......ります。
@raise UncaughtThrowError 同じ tag で待っている catch が存在しない場合に発生します。
//emlist[例][ruby]{
def foo
throw :exit, 25
end
ret = catch(:exit) do
begin
foo
some_process() # 絶対に実行されない
10
ensure
puts "ensure"... -
void rb
_ throw(const char *tag , VALUE val) (122.0) -
throw の実体。返り値を val として、 tag を catch したところまでジャンプします。
...throw の実体。返り値を val として、
tag を catch したところまでジャンプします。
rb_catch も参照してください。...