るりまサーチ

最速Rubyリファレンスマニュアル検索!
1004件ヒット [601-700件を表示] (0.233秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

モジュール

オブジェクト

キーワード

検索結果

<< < ... 5 6 7 8 9 ... > >>

Enumerator::Lazy#force(*args) -> [object] (8012.0)

全ての要素を含む配列を返します。Lazy から実際に値を取り出すのに使います。

...要素を含む配列を返します。Lazy から実際に値を取り出すのに使います。

Enumerable#to_a のエイリアスです。

//emlist[例][ruby]{
1.step.lazy.take(10).force
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

1.step.lazy.take(10).to_a
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}...

MatchData#values_at(*index) -> [String] (8012.0)

正規表現中の n 番目の括弧にマッチした部分文字列の配列を返します。

....match("foobarbaz")
# same as m.to_a.values_at(...)
p m.values_at(0, 1, 2, 3, 4) # => ["foobarbaz", "foo", "bar", "baz", nil]
p m.values_at(-1, -2, -3, -4, -5) # => ["baz", "bar", "foo", nil, nil]

m = /(?<a>\d+) *(?<op>[+\-*\/]) *(?<b>\d+)/.match("1 + 2")
m.to_a # => ["1 + 2"...

String#each_codepoint -> Enumerator (8012.0)

文字列の各コードポイントに対して繰り返します。

...なります。

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
"hello わーるど".encode('euc-jp').each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 42223, 41404, 42219, 42185]
//}

@see String#codepo...

String#each_codepoint {|codepoint| block } -> self (8012.0)

文字列の各コードポイントに対して繰り返します。

...なります。

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
"hello わーるど".encode('euc-jp').each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 42223, 41404, 42219, 42185]
//}

@see String#codepo...

String#each_grapheme_cluster -> Enumerator (8012.0)

文字列の書記素クラスタに対して繰り返します。

...har と違って、
Unicode Standard Annex #29 (https://unicode.org/reports/tr29/)
で定義された書記素クラスタに対して繰り返します。

//emlist[例][ruby]{
"a\u0300".each_char.to_a.size # => 2
"a\u0300".each_grapheme_cluster.to_a.size # => 1
//}

@see String#grapheme_clusters...

絞り込み条件を変える

String#each_grapheme_cluster {|grapheme_cluster| block } -> self (8012.0)

文字列の書記素クラスタに対して繰り返します。

...har と違って、
Unicode Standard Annex #29 (https://unicode.org/reports/tr29/)
で定義された書記素クラスタに対して繰り返します。

//emlist[例][ruby]{
"a\u0300".each_char.to_a.size # => 2
"a\u0300".each_grapheme_cluster.to_a.size # => 1
//}

@see String#grapheme_clusters...

ARGF.class#each_byte -> Enumerator (8006.0)

ARGF の現在位置から 1 バイトずつ読み込み、それを整数として与え、ブロックを実行します。 ブロック引数byteは0..255のいずれかの整数です。

...現在位置の1バイトについてファイル名を得るには
ARGF.class#filename を使用します。

ブロックが与えられなかった場合は、Enumerator オブジェクトを生成して返します。

例:

ARGF.each_byte.to_a # => [35, 32, ... 95, 10]

@see IO#each_byte...

ARGF.class#each_byte { |byte| ...} -> self (8006.0)

ARGF の現在位置から 1 バイトずつ読み込み、それを整数として与え、ブロックを実行します。 ブロック引数byteは0..255のいずれかの整数です。

...現在位置の1バイトについてファイル名を得るには
ARGF.class#filename を使用します。

ブロックが与えられなかった場合は、Enumerator オブジェクトを生成して返します。

例:

ARGF.each_byte.to_a # => [35, 32, ... 95, 10]

@see IO#each_byte...

Array#sample -> object | nil (8006.0)

配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。

...した場合に発生します。

@raise ArgumentError 引数 n に負の数を指定した場合に発生します。

//emlist[例][ruby]{
a = (1..10).to_a
p a.sample #=> 9
p a.sample #=> 10
p a.sample(3) #=> [1, 9, 3]
p a #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}...

Array#sample(n) -> Array (8006.0)

配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。

...した場合に発生します。

@raise ArgumentError 引数 n に負の数を指定した場合に発生します。

//emlist[例][ruby]{
a = (1..10).to_a
p a.sample #=> 9
p a.sample #=> 10
p a.sample(3) #=> [1, 9, 3]
p a #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}...

絞り込み条件を変える

<< < ... 5 6 7 8 9 ... > >>