るりまサーチ

最速Rubyリファレンスマニュアル検索!
264件ヒット [1-100件を表示] (0.175秒)
トップページ > クエリ:l[x] > クエリ:>[x] > クエリ:n[x] > クエリ:$2[x]

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. float >
  4. module >
  5. complex >

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 > >>

Kernel$$2 -> String | nil (21429.0)

最後に成功したパターンマッチで n 番目の括弧にマッチした値が格納されます。 該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

...ンマッチで n 番目の括弧にマッチした値が格納されます。
該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

番号 n はいくらでも大きな正整数を利用できます。

Regexp.last_match(1),
Regexp.last_match(2), ......
...れらの変数はローカルスコープかつスレッドローカル、読み取り専用です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
if %r[<a href="(.*?)">(.*?)</a>] =~ str
print $1
print $2
end
#=> "http://example.com"
#=> "example.com"
//}...

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

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

...ます。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。

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

@param start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得...
...nge オブジェクトを指定します。

@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
foo
end

bar

#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in `<main...
...13:in `<main>'"]
# ["-:13:in `<main>'"]
# []
# nil
//}

以下の関数は、caller の要素から [ファイル名, 行番号, メソッド名]
を取り出して返します。

//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
l
ine = $2.to...

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

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

...ます。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。

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

@param start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得...
...nge オブジェクトを指定します。

@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
foo
end

bar

#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in `<main...
...13:in `<main>'"]
# ["-:13:in `<main>'"]
# []
# nil
//}

以下の関数は、caller の要素から [ファイル名, 行番号, メソッド名]
を取り出して返します。

//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
l
ine = $2.to...

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

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

...ます。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。

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

@param start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得...
...nge オブジェクトを指定します。

@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
foo
end

bar

#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in `<main...
...13:in `<main>'"]
# ["-:13:in `<main>'"]
# []
# nil
//}

以下の関数は、caller の要素から [ファイル名, 行番号, メソッド名]
を取り出して返します。

//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
l
ine = $2.to...

Kernel.#sprintf(format, *arg) -> String (9218.0)

format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。

...rintf と同じように解釈し、
引数をフォーマットした文字列を返します。

@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime

=== sprintf フォーマット

Ruby の sprint...
...には %+x、% x のように指定します。


以下は sprintf フォーマットの書式です。[] で囲まれた部分は省略可
能であることを示しています。

%[nth$][フラグ][幅][.精度]指示子
%[<name>][フラグ][幅][.精度]指示子

`%' 自身を出力する...
...=> "3, 2, 1"

p sprintf("%1$d, %1$x, %1$o", 10) #=> "10, a, 12"
//}
状況によってフォーマットを変えたいが引数の順序を変えたくない場合に使
用します。
//emlist[][ruby]{
case ENV['LC_TIME']
when /^ja_JP/
fmt = "%1$d年%2$d月%3$d日"
else
fmt = "%2$02d/%03$2d...

絞り込み条件を変える

Kernel$$1 -> String | nil (6329.0)

最後に成功したパターンマッチで n 番目の括弧にマッチした値が格納されます。 該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

...ンマッチで n 番目の括弧にマッチした値が格納されます。
該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

番号 n はいくらでも大きな正整数を利用できます。

Regexp.last_match(1),
Regexp.last_match(2), ......
...れらの変数はローカルスコープかつスレッドローカル、読み取り専用です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
if %r[<a href="(.*?)">(.*?)</a>] =~ str
print $1
print $2
end
#=> "http://example.com"
#=> "example.com"
//}...

Kernel$$10 -> String | nil (6329.0)

最後に成功したパターンマッチで n 番目の括弧にマッチした値が格納されます。 該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

...ンマッチで n 番目の括弧にマッチした値が格納されます。
該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

番号 n はいくらでも大きな正整数を利用できます。

Regexp.last_match(1),
Regexp.last_match(2), ......
...れらの変数はローカルスコープかつスレッドローカル、読み取り専用です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
if %r[<a href="(.*?)">(.*?)</a>] =~ str
print $1
print $2
end
#=> "http://example.com"
#=> "example.com"
//}...

Kernel$$11 -> String | nil (6329.0)

最後に成功したパターンマッチで n 番目の括弧にマッチした値が格納されます。 該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

...ンマッチで n 番目の括弧にマッチした値が格納されます。
該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

番号 n はいくらでも大きな正整数を利用できます。

Regexp.last_match(1),
Regexp.last_match(2), ......
...れらの変数はローカルスコープかつスレッドローカル、読み取り専用です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
if %r[<a href="(.*?)">(.*?)</a>] =~ str
print $1
print $2
end
#=> "http://example.com"
#=> "example.com"
//}...

Kernel$$3 -> String | nil (6329.0)

最後に成功したパターンマッチで n 番目の括弧にマッチした値が格納されます。 該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

...ンマッチで n 番目の括弧にマッチした値が格納されます。
該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

番号 n はいくらでも大きな正整数を利用できます。

Regexp.last_match(1),
Regexp.last_match(2), ......
...れらの変数はローカルスコープかつスレッドローカル、読み取り専用です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
if %r[<a href="(.*?)">(.*?)</a>] =~ str
print $1
print $2
end
#=> "http://example.com"
#=> "example.com"
//}...

Kernel$$4 -> String | nil (6329.0)

最後に成功したパターンマッチで n 番目の括弧にマッチした値が格納されます。 該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

...ンマッチで n 番目の括弧にマッチした値が格納されます。
該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

番号 n はいくらでも大きな正整数を利用できます。

Regexp.last_match(1),
Regexp.last_match(2), ......
...れらの変数はローカルスコープかつスレッドローカル、読み取り専用です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
if %r[<a href="(.*?)">(.*?)</a>] =~ str
print $1
print $2
end
#=> "http://example.com"
#=> "example.com"
//}...

絞り込み条件を変える

<< 1 2 3 > >>