167件ヒット
[1-100件を表示]
(0.062秒)
別のキーワード
種類
- インスタンスメソッド (78)
- モジュール関数 (77)
- 文書 (12)
ライブラリ
- ビルトイン (88)
-
minitest
/ unit (1) - objspace (55)
-
rdoc
/ context (11)
クラス
- Binding (6)
- Exception (11)
-
MiniTest
:: Unit (1) - Module (5)
- Proc (11)
-
RDoc
:: Context (11) -
Thread
:: Backtrace :: Location (33)
モジュール
- Kernel (22)
- ObjectSpace (55)
キーワード
-
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (5) -
absolute
_ path (11) -
allocation
_ sourcefile (11) -
allocation
_ sourceline (11) -
backtrace
_ locations (11) -
caller
_ locations (22) -
const
_ source _ location (5) - inspect (11)
- path (11)
-
record
_ location (11) -
source
_ location (17) -
trace
_ object _ allocations (11) -
trace
_ object _ allocations _ start (11) -
trace
_ object _ allocations _ stop (11)
検索結果
先頭5件
-
MiniTest
:: Unit # location(exception) -> String (24401.0) -
与えられた例外の発生した場所を返します。
与えられた例外の発生した場所を返します。 -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (18423.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...バックトレース情報を返します。Exception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require......f get_exception
return begin
yield
rescue => e
e
end
end
e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_exception'", "test.rb:15:in `<main>'"]
//}
@see Exception#backtrac... -
ObjectSpace
. # trace _ object _ allocations _ stop -> nil (18300.0) -
オブジェクト割り当てのトレースを終了します。
...オブジェクト割り当てのトレースを終了します。
トレースを終了する為には、ObjectSpace.#trace_object_allocations_startを呼んだ回数分だけこのメソッドを呼ぶ必要があります。
@see ObjectSpace.#trace_object_allocations_start... -
Proc
# source _ location -> [String , Integer] | nil (15237.0) -
ソースコードのファイル名と行番号を配列で返します。
...by]{
# /path/to/target.rb を実行
proc {}.source_location # => ["/path/to/target.rb", 1]
proc {}.source_location # => ["/path/to/target.rb", 2]
(eval "proc {}").source_location # => ["(eval)", 1]
method(:p).to_proc.source_location # => nil
//}
@see Method#source_location... -
ObjectSpace
. # trace _ object _ allocations { . . . } (15206.0) -
与えられたブロック内でオブジェクトのトレースを行います。
...のトレースを行います。
//emlist[例][ruby]{
require 'objspace'
class C
include ObjectSpace
def foo
trace_object_allocations do
obj = Object.new
p "#{allocation_sourcefile(obj)}:#{allocation_sourceline(obj)}"
end
end
end
C.new.foo #=> "objtrace.rb:8"
//}... -
ObjectSpace
. # allocation _ sourcefile(object) -> String (15200.0) -
objectの元となったソースファイル名を返します。
...objectの元となったソースファイル名を返します。
@param object 元となるソースファイル名を取得したいobjectを指定します。
@return objectの元となるソースファイル名を返します。存在しない場合はnilを返します。
//emlist[例:test......uire 'objspace'
ObjectSpace::trace_object_allocations_start
obj = Object.new
puts "file:#{ObjectSpace::allocation_sourcefile(obj)}" # => file:test.rb
ObjectSpace::trace_object_allocations_stop
//}
@see ObjectSpace.#trace_object_allocations_start,
ObjectSpace.#trace_object_allocations_stop... -
ObjectSpace
. # allocation _ sourceline(object) -> Integer (15200.0) -
objectの元となったソースファイルの行番号を返します。
...す。
@param object 元となるソースファイルの行番号を取得したいobjectを指定します。
@return objectの元となるソースファイルの行番号を返します。存在しない場合はnilを返します。
//emlist[例][ruby]{
require 'objspace'
ObjectSpace::trace_......object_allocations_start
obj = Object.new
puts "line:#{ObjectSpace::allocation_sourceline(obj)}" # => line:4
ObjectSpace::trace_object_allocations_stop
//}
@see ObjectSpace.#trace_object_allocations_start,
ObjectSpace.#trace_object_allocations_stop... -
ObjectSpace
. # trace _ object _ allocations _ start -> nil (15200.0) -
オブジェクト割り当てのトレースを開始します。
...オブジェクト割り当てのトレースを開始します。
@see ObjectSpace.#trace_object_allocations_stop... -
Kernel
. # caller _ locations(range) -> [Thread :: Backtrace :: Location] | nil (12442.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...を Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@param range 取得し......uby]{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
test3(1, nil)
# =>......(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9, 13]
# => ["/Users/user/test.rb", "/Users/user/test.rb"]
test3(2, 1)
# => ["/Users/user/test.rb:13:in `test3'"]
# => [13]
# => ["/Users/user/test.rb"]
//}
@see Thread::Backtrace::Location, Kernel.#caller... -
Kernel
. # caller _ locations(start = 1 , length = nil) -> [Thread :: Backtrace :: Location] | nil (12442.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...を Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@param range 取得し......uby]{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
test3(1, nil)
# =>......(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9, 13]
# => ["/Users/user/test.rb", "/Users/user/test.rb"]
test3(2, 1)
# => ["/Users/user/test.rb:13:in `test3'"]
# => [13]
# => ["/Users/user/test.rb"]
//}
@see Thread::Backtrace::Location, Kernel.#caller...