110件ヒット
[1-100件を表示]
(0.100秒)
ライブラリ
- ビルトイン (44)
クラス
モジュール
- Kernel (33)
キーワード
- Ruby用語集 (11)
-
catch
_ i (11) - debug (11)
- disassemble (11)
-
rb
_ catch (11) -
rb
_ f _ catch (11) -
rb
_ throw (11) - throw (11)
検索結果
先頭5件
-
Kernel
. # catch {|tag| . . . . } -> object (21124.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 (21124.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) (6446.0) -
catch と同等の動作を実行します。
...
catch と同等の動作を実行します。
まず proc に、yield された値と data を渡して実行します。
その途中で tag が throw されたら rb_catch 全体を終了します。
throw が発生した場合はその値を返します。
throw が発生しなかったとき......VALUE
foo_yield(VALUE a, VALUE b)
{
return rb_yield(b);
}
static VALUE
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_catch, 0);
rb_define_method(Foo, "abort", foo_abort, 0);
}... -
static VALUE rb
_ f _ catch(VALUE dmy , VALUE tag) (6400.0) -
-
static VALUE catch
_ i(ID tag) (6200.0) -
-
Kernel
. # throw(tag , value = nil) -> () (3168.0) -
Kernel.#catchとの組み合わせで大域脱出を行います。 throw は同じ tag を指定した catch のブロックの終わりまでジャンプします。
...Kernel.#catchとの組み合わせで大域脱出を行います。 throw
は同じ tag を指定した catch のブロックの終わりまでジャンプします。
throw は探索時に呼び出しスタックをさかのぼるので、
ジャンプ先は同じメソッド内にあるとは限......待っている catch が存在しない場合は、例外で
スレッドが終了します。
同じ tag であるとは Object#object_id が同じであるという意味です。
@param tag catch の引数に対応する任意のオブジェクトです。
@param value catch の戻り値にな......いる catch が存在しない場合に発生します。
//emlist[例][ruby]{
def foo
throw :exit, 25
end
ret = catch(:exit) do
begin
foo
some_process() # 絶対に実行されない
10
ensure
puts "ensure"
end
end
puts ret
#=> ensure
# 25
//}
@see Kernel.#catch... -
RubyVM
:: InstructionSequence . disassemble(body) -> String (3118.0) -
引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字 列に変換して返します。
...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 num, 0
0012 leave
例2:Method オブジェク......トを指定した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
puts RubyVM::InstructionSequence.disasm(method(:hello))
出力:
== disasm: <RubyVM::InstructionSequence:hello@/tmp/method.rb>============
0000 trace 8... -
Ruby用語集 (3006.0)
-
Ruby用語集 A B C D E F G I J M N O R S Y
... ra wa
=== 記号・数字
: %記法
: % notation
「%」記号で始まる多種多様なリテラル記法の総称。
参照:d:spec/literal#percent
: 0 オリジン
: zero-based
番号が 0 から始まること。
例えば、
Array や Vector、Matrix などの要素の番......た。
: blade
Ruby の各種メーリングリストのアーカイブ。
http://blade.nagaokaut.ac.jp/ruby/
: bundled gem
標準添付ライブラリーの gem のうち、アンインストールできるもの。
→ default gem、標準添付ライブラリー
: Bundler
特定の......ト
===[a:ta] た
: 大域脱出
: non-local exit
Ruby においては、例外の発生もしくは Kernel.#throw によって
処理の実行が中断されること。
例外の場合は begin/rescue によって、throw の場合は
Kernel.#catch によって捕捉されるまで、制... -
void rb
_ throw(const char *tag , VALUE val) (122.0) -
throw の実体。返り値を val として、 tag を catch したところまでジャンプします。
...throw の実体。返り値を val として、
tag を catch したところまでジャンプします。
rb_catch も参照してください。... -
debug (24.0)
-
Ruby デバッガです。Ruby スクリプトのソースコードデバッグに使用します。
...た、Emacs を使用したインタフェース rubydb3x.el が
https://github.com/ruby/elisp にあるので、活用してください。
=== 使い方
$ ruby -rdebug foo.rb
または、Emacs から
M-x load-library rubydb3x.el
M-x rubydb
=== デバッグコマンド
以下は、......ます。
ここに挙げたもの以外を入力した場合、その入力を ruby の式として評価します。
: break
: break [<file>:]<position>|<class>:<method>
ブレークポイントを設定します。引数を省略した場合設定したブレークポ
イントを表示......た場合は現在実行中のファイルを指定した
ものと見倣されます。
このコマンドの省略形は b です。
: catch <an Exception>
例外が発生した時にデバッガを停止させるキャッチポイントを設定します。
引数を省略した...