るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

キーワード

検索結果

<< < 1 2 >>

TracePoint#return_value -> object (6125.0)

メソッドやブロックの戻り値を返します。

...

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

//emlist[例][ruby]{
def foo(ret)
ret
end
t
race = TracePoint.new(:return) do |tp|
p tp.return_value # => 1
end
t
race.enable...

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

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

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

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

t
race.disable do
t
race.enabled? # => false
end

t
race.enabled? # => true
//}

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

t
ra...
...ce.enable { p trace.lineno }
# => RuntimeError: access from outside

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

TracePoint#lineno -> Integer (3125.0)

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

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

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

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

TracePoint#defined_class -> Class | module (3073.0)

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

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

メソッドがモジュールで定義されていた場合も(include に関係なく)モジュー
ルを返します。

//emlist[例][ruby]{
modul...
...d; end
class C; include M; end;
t
race = 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
t
race = 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#disable -> bool (3043.0)

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

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

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

t
race.disable do
t
race.enabled? # => false
end

t
race.enabled? # => true
//}

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

t
ra...
...ce.enable { p trace.lineno }
# => RuntimeError: access from outside

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

絞り込み条件を変える

TracePoint#callee_id -> Symbol | nil (3031.0)

イベントが発生したメソッドの呼ばれた名前を Symbol で返します。 トップレベルであった場合は nil を返します。

...

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

//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end

t
race = TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :alias_name]
end
t
race.e...
...nable do
C.new.alias_name
end
//}

@
see TracePoint#method_id...

BigDecimal#coerce(other) -> Array (149.0)

self と other が同じクラスになるよう、self か other を変換し [other, self] という配列にして返します。

...self と other が同じクラスになるよう、self か other を変換し [other,
self] という配列にして返します。

@
param other 比較または変換するオブジェクト

BigDecimal#coerce は Ruby における強制型変換のための機能です。
BigDecimal オブジェ...
...ブジェクト間の各種の計算は
BigDecimal#coerce の結果を元に行われます。

//emlist[][ruby]{
require "bigdecimal"
a = BigDecimal("1.0")
b = a / 2.0 # => 0.5e0
//}

other に Rational オブジェクトを指定した場合は self の有効桁数を
用いて変換を行いま...
...す。

数値を表す文字列から BigDecimal オブジェクトに変換する機能はデフォ
ルトでは無効になっています。必要な場合は ENABLE_NUMERIC_STRING を有効に
して Ruby をコンパイルしてください。...
<< < 1 2 >>