るりまサーチ

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

別のキーワード

  1. _builtin length
  2. csv length
  3. digest block_length
  4. rss length=
  5. dbm length

種類

ライブラリ

モジュール

検索結果

Kernel.#caller_locations(start = 1, length = nil) -> [Thread::Backtrace::Location] | nil (18269.0)

現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。

...ram length 取得するフレームの個数を指定します。

@param range 取得したいフレームの範囲を示す Range オブジェクトを指定します。

//emlist[例][ruby]{
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)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]...

Kernel.#caller_locations(range) -> [Thread::Backtrace::Location] | nil (18169.0)

現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。

...ram length 取得するフレームの個数を指定します。

@param range 取得したいフレームの範囲を示す Range オブジェクトを指定します。

//emlist[例][ruby]{
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)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]...

Ruby用語集 (24.0)

Ruby用語集 A B C D E F G I J M N O R S Y

...子である。
「[*0..9]」におけるいわゆる splat 展開の * や、
Proc オブジェクトをブロックとして渡す「strs.map(&:length)」に
おける & も演算子である。
defined? のように、見た目がメソッドのような演算子もある。

参照:s...
...時点において、そこに至るメソッド呼び出し元情報を遡るデータ。
バックトレースともいう。

Kernel.#caller_locations、Kernel.#caller で現時点までの
スタックトレースを得ることができる。

また、例外オブジェクトは例外...
...別名
: alias
メソッドやグローバル変数は別名を持つことができる。

Ruby の組み込みメソッドには、Enumerable#map と Enumerable#collect の
ように別名を持つものが多数ある。

参照:d:spec/def#alias

: 変数
: variable
Ruby の変数は...