るりまサーチ

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

別のキーワード

  1. range max
  2. range min
  3. net/http set_range
  4. httpheader set_range
  5. range step

ライブラリ

クラス

モジュール

検索結果

Kernel.#caller(range) -> [String] | nil (18312.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...情報を $@
の形式のバックトレース(文字列の配列)として返します。

トップレベルでは空の配列を返します。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。

引数で指定した値が範囲外の場合は nil を...
...す。

@param range 取得したいスタックの範囲を示す Range オブジェクトを指定します。

@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations

//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end

def bar...
...caller の要素から [ファイル名, 行番号, メソッド名]
を取り出して返します。

//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end

def foo
p parse_caller(cal...

Kernel.#caller(start = 1) -> [String] | nil (18212.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...情報を $@
の形式のバックトレース(文字列の配列)として返します。

トップレベルでは空の配列を返します。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。

引数で指定した値が範囲外の場合は nil を...
...す。

@param range 取得したいスタックの範囲を示す Range オブジェクトを指定します。

@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations

//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end

def bar...
...caller の要素から [ファイル名, 行番号, メソッド名]
を取り出して返します。

//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end

def foo
p parse_caller(cal...

Kernel.#caller(start, length) -> [String] | nil (18212.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...情報を $@
の形式のバックトレース(文字列の配列)として返します。

トップレベルでは空の配列を返します。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。

引数で指定した値が範囲外の場合は nil を...
...す。

@param range 取得したいスタックの範囲を示す Range オブジェクトを指定します。

@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations

//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end

def bar...
...caller の要素から [ファイル名, 行番号, メソッド名]
を取り出して返します。

//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end

def foo
p parse_caller(cal...

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

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

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

@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>'"]
# =>...
...(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 (6133.0)

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

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

@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>'"]
# =>...
...(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...

絞り込み条件を変える

Thread#backtrace_locations(range) -> [Thread::Backtrace::Location] | nil (119.0)

スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。

...定します。

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

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

Kernel.#caller_locations と似ていますが、本メソッドは self に限定
した情報を返しま...

NEWS for Ruby 2.0.0 (48.0)

NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...uffle! と Array#sample の random パラメータには最大値のみを指定することが可能になりました
* Array#values_at に Range オブジェクトを与えた場合、配列の範囲外のインデックスについては nil を返します

* Enumerable
* 追加: En...
...対パ スで返します。
* 追加: Kernel.#caller_locations フレーム情報の配列を返します
* 拡張: Kernel.#warn Kernel.#puts のように複数の引数を受け付けるようになりました
* 拡張: Kernel.#caller 第2引数で取得するスタックのサイズ...
...#eql? を削除。

* Process
* 追加: Process#getsid session id を取得します(unix のみ)。

* Range
* 追加: Range#size サイズの遅延評価
* 追加: Range#bsearch 二分探索

* RubyVM (MRI specific)
* 追加: RubyVM::InstructionSequence.of to get the instruc...

Thread#backtrace_locations(start = 0, length = nil) -> [Thread::Backtrace::Location] | nil (19.0)

スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。

...定します。

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

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

Kernel.#caller_locations と似ていますが、本メソッドは self に限定
した情報を返しま...

Ruby用語集 (18.0)

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

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

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

また、例外オブジェクトは例外が発生...
...ーを明示して
呼び出すなど、構文上、メソッド名であることが明らかな場面では使える場合もある。
実際 Range クラスには begin、end というインスタンスメソッドが定義されている。
また、インスタンス変数、クラス変...