るりまサーチ

最速Rubyリファレンスマニュアル検索!
77件ヒット [1-77件を表示] (0.099秒)
トップページ > クエリ:l[x] > クエリ:$DEBUG[x]

別のキーワード

  1. matrix l
  2. kernel $-l
  3. _builtin $-l
  4. lupdecomposition l
  5. l matrix

種類

ライブラリ

モジュール

キーワード

検索結果

Kernel$$DEBUG -> bool (18201.0)

この値が真のときはインタプリタがデバッグモードになります。

この値が真のときはインタプリタがデバッグモードになります。

コマンドラインオプション -d でセットされます。
スクリプトから代入することもできます。

デバッグモードでは、通常モードに比べて以下の違いがあります。

* 通常時はいずれかのスレッドが例外によって終了しても
他のスレッドは実行を続けますが、デバッグモードでは
いずれかのスレッドが例外によって終了した時に
インタプリタ全体が中断されるようになります。
Thread.abort_on_exception を
true にセットするのと同じ効果です。
* Thread.abort_on_excep...

Kernel.#caller(range) -> [String] | nil (6112.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...ます。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。

引数で指定した値が範囲外の場合は nil を返します。

@param start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得...
...囲を示す Range オブジェクトを指定します。

@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations

//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end

def bar
foo
end

bar

#=> ["-:2:in `foo'", "-:10:in `bar'",...
...~ at
file = $1
l
ine = $2.to_i
method = $3
[file, line, method]
end
end

def foo
p parse_caller(caller.first)
end

def bar
foo
p parse_caller(caller.first)
end

bar
p parse_caller(caller.first)

#=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}

以下は、$DEBUG が真の...

Kernel.#caller(start = 1) -> [String] | nil (6112.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...ます。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。

引数で指定した値が範囲外の場合は nil を返します。

@param start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得...
...囲を示す Range オブジェクトを指定します。

@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations

//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end

def bar
foo
end

bar

#=> ["-:2:in `foo'", "-:10:in `bar'",...
...~ at
file = $1
l
ine = $2.to_i
method = $3
[file, line, method]
end
end

def foo
p parse_caller(caller.first)
end

def bar
foo
p parse_caller(caller.first)
end

bar
p parse_caller(caller.first)

#=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}

以下は、$DEBUG が真の...

Kernel.#caller(start, length) -> [String] | nil (6112.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...ます。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。

引数で指定した値が範囲外の場合は nil を返します。

@param start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得...
...囲を示す Range オブジェクトを指定します。

@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations

//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end

def bar
foo
end

bar

#=> ["-:2:in `foo'", "-:10:in `bar'",...
...~ at
file = $1
l
ine = $2.to_i
method = $3
[file, line, method]
end
end

def foo
p parse_caller(caller.first)
end

def bar
foo
p parse_caller(caller.first)
end

bar
p parse_caller(caller.first)

#=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}

以下は、$DEBUG が真の...

Kernel$$-d -> bool (3101.0)

この値が真のときはインタプリタがデバッグモードになります。

この値が真のときはインタプリタがデバッグモードになります。

コマンドラインオプション -d でセットされます。
スクリプトから代入することもできます。

デバッグモードでは、通常モードに比べて以下の違いがあります。

* 通常時はいずれかのスレッドが例外によって終了しても
他のスレッドは実行を続けますが、デバッグモードでは
いずれかのスレッドが例外によって終了した時に
インタプリタ全体が中断されるようになります。
Thread.abort_on_exception を
true にセットするのと同じ効果です。
* Thread.abort_on_excep...

絞り込み条件を変える

制御構造 (3006.0)

制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END

...制御構造
条件分岐:
* if
* unless
* case
繰り返し:
* while
* until
* for
* break
* next
* redo
* retry
例外処理:
* raise
* begin
その他:
* return
* BEGIN
* END

Rubyでは(Cなどとは異なり)制御構造は式であ...
...値を返さない式を代入式の右辺に置くと
syntax error になります)。

RubyはC言語やPerlから引き継いだ制御構造を持ちますが、
その他にd:spec/call#blockという
制御構造の抽象化を援助する機能があります。ブロック付きメソッド呼...
...の条件式が正規表現のリテラルである時には特別に

//emlist[][ruby]{
$_ =~ リテラル
//}

であるかのように評価されます。

==== if 修飾子

//emlist[例][ruby]{
print "debug\n" if $DEBUG
//}

文法:

式 if 式

右辺の条件が成立する時に...

irb (18.0)

irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。

...001:0> 1+2
3
irb(main):002:0> class Foo
irb(main):003:1> def foo
irb(main):004:2> print 1
irb(main):005:2> end
irb(main):006:1> end
:foo
irb(main):007:0>

また irb コマンドは readline ライブラリにも対応しています。
readline ライブラリがインスト...
...file_name opts
options:
-f ~/.irbrc を読み込まない
-m bc モード (分数と行列の計算ができる)
-d $DEBUG を true にする (ruby -d と同じ)
-w ruby -w と同じ
-W[level=2] ruby -W と同じ
-r lib...
...pect 結果出力にinspectを用いない
--readline readlineライブラリを利用する
--noreadline readlineライブラリを利用しない。デフォルトでは
inf-ruby-mode 以外で readline ライブラリを利用する。
--prompt prompt-m...
...ンオプション

irb [options] file_name opts
options:
-f ~/.irbrc を読み込まない
-d $DEBUG を true にする (ruby -d と同じ)
-w ruby -w と同じ
-W[level=2] ruby -W と同じ
-r library ruby -r と同じ
-I...