るりまサーチ

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

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

クラス

モジュール

キーワード

検索結果

Thread::Backtrace::Location#to_s -> String (18121.0)

self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。

...レームを Kernel.#caller と同じ表現にした文字列を返し
ます。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.to_s
end

# => path/to/foo....

Kernel.#set_trace_func(proc) -> Proc (68.0)

Ruby インタプリタのイベントをトレースする Proc オブジェクトとして 指定された proc を登録します。 nil を指定するとトレースがオフになります。

...表す、以下のいずれかの文字列。
//emlist{
"line": 式の評価。
"call": メソッドの呼び出し。
"return": メソッド呼び出しからのリターン。
"c-call": Cで記述されたメソッドの呼び出し。
"c-return": Cで記述されたメ...
...ist{
line
最後に呼び出されたメソッドを表す Symbol オブジェクト。
トップレベルでは nil。
call
/return/c-call/c-return
呼び出された/リターンするメソッドを表す Symbol オブジェクト。
class/end
nil。...
...最後に呼び出されたメソッドが属するクラスを表す
Class オブジェクト。トップレベルでは nil。
call
/return/c-call/c-return
呼び出された/リターンするメソッドが属するクラス
を表す Class オブジェクト。...

Thread#set_trace_func(pr) -> Proc | nil (50.0)

スレッドにトレース用ハンドラを設定します。

...[例][ruby]{
th = Thread.new do
class Trace
end
2.to_s
Thread.current.set_trace_func nil
3.to_s
end
th.set_trace_func lambda {|*arg| p arg }
th.join

# => ["line", "example.rb", 2, nil, #<Binding:0x00007fc8de87cb08>, nil]
# => ["c-call", "example.rb", 2, :inherited, #<Binding:0x00007fc8de8...
...007fc8de88c440>, nil]
# => ["c-call", "example.rb", 4, :to_s, #<Binding:0x00007fc8de896f30>, Integer]
# => ["c-return", "example.rb", 4, :to_s, #<Binding:0x00007fc8de894a50>, Integer]
# => ["line", "example.rb", 5, nil, #<Binding:0x00007fc8de967b08>, nil]
# => ["c-call", "example.rb", 5, :current, #...
...<Binding:0x00007fc8de967798>, Thread]
# => ["c-return", "example.rb", 5, :current, #<Binding:0x00007fc8de9673b0>, Thread]
# => ["c-call", "example.rb", 5, :set_trace_func, #<Binding:0x00007fc8de966fc8>, Thread]
//}

@param pr トレースハンドラ(Proc オブジェクト) もしくは nil
@see Th...

Thread::Backtrace::Location (38.0)

Ruby のフレームを表すクラスです。

...nel.#caller_locations から生成されます。

//emlist[例1][ruby]{
# caller_locations.rb
def a(skip)
call
er_locations(skip)
end
def b(skip)
a(skip)
end
def c(skip)
b(skip)
end

c(0..2).map do |call|
puts call.to_s
end
//}

例1の実行結果:

call
er_locations.rb:2:in `a'
call
er_l...
...ocations.rb:5:in `b'
call
er_locations.rb:8:in `c'

//emlist[例2][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.to_s
end
//}

例2の実行結果:

init.rb:4:in `ini...

Thread#add_trace_func(pr) -> Proc (32.0)

スレッドにトレース用ハンドラを追加します。

...ェクト)

//emlist[例][ruby]{
th = Thread.new do
class Trace
end
43.to_s
end
th.add_trace_func lambda {|*arg| p arg }
th.join

# => ["line", "example.rb", 4, nil, #<Binding:0x00007f98e107d0d8>, nil]
# => ["c-call", "example.rb", 4, :inherited, #<Binding:0x00007f98e1087448>, Class]
# => ["c-...
...08e5e0>, nil]
# => ["line", "example.rb", 6, nil, #<Binding:0x00007f98e108d4b0>, nil]
# => ["c-call", "example.rb", 6, :to_s, #<Binding:0x00007f98e1097aa0>, Integer]
# => ["c-return", "example.rb", 6, :to_s, #<Binding:0x00007f98e1095cc8>, Integer]
//}

@see Thread#set_trace_func Kernel.#set_trace_fu...

絞り込み条件を変える

Thread::Backtrace::Location#inspect -> String (30.0)

Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。

...tion#to_s の結果を人間が読みやすいような文
字列に変換したオブジェクトを返します。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
p...

Symbol#to_proc -> Proc (26.0)

self に対応する Proc オブジェクトを返します。

...self に対応する Proc オブジェクトを返します。

生成される Proc オブジェクトを呼びだす(Proc#call)と、
Proc#callの第一引数をレシーバとして、 self という名前のメソッドを
残りの引数を渡して呼びだします。


//emlist[明示的に...
.../emlist[暗黙に呼ばれる例][ruby]{
# メソッドに & とともにシンボルを渡すと
# to_proc が呼ばれて Proc 化され、
# それがブロックとして渡される。
(1..3).collect(&:to_s) # => ["1", "2", "3"]
(1..3).select(&:odd?) # => [1, 3]
//}

@see d:spec/call#block...
...self に対応する Proc オブジェクトを返します。

生成される Proc オブジェクトを呼びだす(Proc#call)と、
Proc#callの第一引数をレシーバとして、 self という名前のメソッドを
残りの引数を渡して呼びだします。

生成される Proc...