るりまサーチ

最速Rubyリファレンスマニュアル検索!
33件ヒット [1-33件を表示] (0.035秒)
トップページ > クエリ:String[x] > クエリ:$1[x] > 種類:モジュール関数[x]

別のキーワード

  1. string []=
  2. string []
  3. string slice
  4. string slice!
  5. string gsub

ライブラリ

モジュール

検索結果

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

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

..., メソッド名]
を取り出して返します。

//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(caller.first)
end

def bar
foo
p parse_caller(cal...

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

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

..., メソッド名]
を取り出して返します。

//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(caller.first)
end

def bar
foo
p parse_caller(cal...

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

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

..., メソッド名]
を取り出して返します。

//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(caller.first)
end

def bar
foo
p parse_caller(cal...