るりまサーチ

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

別のキーワード

  1. socket int
  2. prime int_from_prime_division
  3. _builtin to_int
  4. mkmf convertible_int
  5. option int

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

Matrix#trace -> Integer | Float | Rational | Complex (15236.0)

トレース (trace) を返します。

...トレース (trace) を返します。

行列のトレース (trace) とは、対角要素の和です。

//emlist[例][ruby]{
require 'matrix'
Matrix[[7,6], [3,9]].trace # => 16
//}

trace
は正方行列でのみ定義されます。

@raise ExceptionForMatrix::ErrDimensionMismatch 行列が...

IRB::Context#back_trace_limit -> Integer (6208.0)

エラー発生時のバックトレース表示の先頭、末尾の上限の行数を返します。

...エラー発生時のバックトレース表示の先頭、末尾の上限の行数を返します。

デフォルト値は 16 です。

@see IRB::Context#back_trace_limit=...

TracePoint#lineno -> Integer (6113.0)

発生したイベントの行番号を返します。

...発生したイベントの行番号を返します。

@raise RuntimeError イベントフックの外側で実行した場合に発生します。

//emlist[例][ruby]{
def foo(ret)
ret
end
trace
= TracePoint.new(:call, :return) do |tp|
tp.lineno
end
trace
.enable
foo 1
# => 1
# 3
//}...

TracePoint#disable -> bool (6061.0)

self のトレースを無効にします。

...行前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)

//emlist[例][ruby]{
trace
.enabled? # => true
trace
.disable # => false (実行前の状態)
trace
.enabled? # => false
trace
.disable...
...[ruby]{
trace
.enabled? # => true

trace
.disable do
trace
.enabled? # => false
end

trace
.enabled? # => true
//}

[注意] イベントフックのためのメソッドに、ブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。

trace
.enabl...
...e { p trace.lineno }
# => RuntimeError: access from outside

@see TracePoint#enable, TracePoint#enabled?...

TracePoint#disable { ... } -> object (6061.0)

self のトレースを無効にします。

...行前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)

//emlist[例][ruby]{
trace
.enabled? # => true
trace
.disable # => false (実行前の状態)
trace
.enabled? # => false
trace
.disable...
...[ruby]{
trace
.enabled? # => true

trace
.disable do
trace
.enabled? # => false
end

trace
.enabled? # => true
//}

[注意] イベントフックのためのメソッドに、ブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。

trace
.enabl...
...e { p trace.lineno }
# => RuntimeError: access from outside

@see TracePoint#enable, TracePoint#enabled?...

絞り込み条件を変える

TracePoint#enable -> bool (6061.0)

self のトレースを有効にします。

...前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)

//emlist[例][ruby]{
trace
.enabled? # => false
trace
.enable # => false (実行前の状態)

# トレースが有効

trace
.enabled...
...# => true
trace
.enable # => true (実行前の状態)

# 引き続きトレースが有効
//}

ブロックが与えられた場合、ブロック内でのみトレースが有効になります。
この場合はブロックの評価結果を返します。

//emlist[例][ruby]{
trace
.enabled?...
...alse

trace
.enable do
trace
.enabled? # => true
end

trace
.enabled? # => false
//}

[注意] イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。

//emlist[例][ruby]{
trace
.enable { p trace.lin...

TracePoint#enable { ... } -> object (6061.0)

self のトレースを有効にします。

...前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)

//emlist[例][ruby]{
trace
.enabled? # => false
trace
.enable # => false (実行前の状態)

# トレースが有効

trace
.enabled...
...# => true
trace
.enable # => true (実行前の状態)

# 引き続きトレースが有効
//}

ブロックが与えられた場合、ブロック内でのみトレースが有効になります。
この場合はブロックの評価結果を返します。

//emlist[例][ruby]{
trace
.enabled?...
...alse

trace
.enable do
trace
.enabled? # => true
end

trace
.enabled? # => false
//}

[注意] イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。

//emlist[例][ruby]{
trace
.enable { p trace.lin...

TracePoint#defined_class -> Class | module (6031.0)

メソッドを定義したクラスかモジュールを返します。

...メソッドを定義したクラスかモジュールを返します。

//emlist[例][ruby]{
class C; def foo; end; end
trace
= TracePoint.new(:call) do |tp|
p tp.defined_class # => C
end.enable do
C.new.foo
end
//}

メソッドがモジュールで定義されていた場合も(include に...
...class C; include M; end;
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => M
end.enable do
C.new.foo
end
//}

[注意] 特異メソッドを実行した場合は TracePoint#defined_class は特異クラ
スを返します。また、Kernel.#set_trace_func の 6 番目のブロック...
...く元のクラスを返します。

//emlist[例][ruby]{
class C; def self.foo; end; end
trace
= TracePoint.new(:call) do |tp|
p tp.defined_class # => #<Class:C>
end.enable do
C.foo
end
//}

Kernel.#set_trace_func と TracePoint の上記の差分に注意して
ください。

@see 50864...

TracePoint#binding -> Binding (6013.0)

発生したイベントによって生成された Binding オブジェクトを返します。

...発生したイベントによって生成された Binding オブジェクトを返します。


//emlist[例][ruby]{
def foo(ret)
ret
end
trace
= TracePoint.new(:call) do |tp|
p tp.binding.local_variables # => [:ret]
end
trace
.enable
foo 1
//}...
<< 1 2 3 > >>