るりまサーチ

最速Rubyリファレンスマニュアル検索!
484件ヒット [101-200件を表示] (0.081秒)

別のキーワード

  1. array fill
  2. array sample
  3. array []
  4. array slice
  5. array []=

ライブラリ

モジュール

キーワード

検索結果

<< < 1 2 3 4 ... > >>

Enumerator#next_values -> Array (6202.0)

「次」のオブジェクトを配列で返します。

...values の違いを][ruby]{
o = Object.new
def o.each
yield
yield 1
yield 1, 2
yield nil
yield [1, 2]
end
e = o.to_enum
p e.next_values
p e.next_values
p e.next_values
p e.next_values
p e.next_values
e = o.to_enum
p e.next
p e.next
p e.next
p e.next
p e.next

## yield args next_value...
...[1] 1
# yield 1, 2 [1, 2] [1, 2]
# yield nil [nil] nil
# yield [1, 2] [[1, 2]] [1, 2]
//}

@raise StopIteration 列挙状態が既に最後へ到達しているとき
@see Enumerator#next, Enumerator#peek, Enumerator#peek_values...

Enumerator#peek_values -> Array (6202.0)

Enumerator#next_values のように「次」のオブジェクトを 配列で返しますが、列挙状態を変化させません。

...Enumerator#next_values のように「次」のオブジェクトを
配列で返しますが、列挙状態を変化させません。

Enumerator#next, Enumerator#next_values のように
現在までの列挙状態に応じて「次」のオブジェクトを返しますが、
next と異なり...
...r#next_values と同様
yield

yield nil
を区別するために使えます。

//emlist[例][ruby]{
o = Object.new
def o.each
yield
yield 1
yield 1, 2
end
e = o.to_enum
p e.peek_values #=> []
e.next
p e.peek_values #=> [1]
p e.peek_values #=> [1]
e.next
p e.peek_values #=...
...> [1, 2]
e.next
p e.peek_values # raises StopIteration
//}

@raise StopIteration 列挙状態が既に最後へ到達しているとき
@see Enumerator#next, Enumerator#next_values, Enumerator#peek_values...

OpenSSL::X509::ExtensionFactory#create_ext_from_array(ary) -> OpenSSL::X509::Extension (6134.0)

[oid, value, critical] もしくは [oid, value] という配列から OpenSSL::X509::Extension オブジェクトを生成します。

...[oid, value, critical] もしくは [oid, value] という配列から
OpenSSL::X509::Extension オブジェクトを生成します。

@param ary 生成する拡張領域のデータの配列
@see OpenSSL::X509::ExtensionFactory#create_ext...

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

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

...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", "1", "+", "2"]
m.values_at(:...
...a, :b, :op) # => ["1", "2", "+"]
//}

@see Array#values_at, Array#[]...

Hash#values_at(*keys) -> [object] (6107.0)

引数で指定されたキーに対応する値の配列を返します。

...引数が指定されなかった場合は、空の配列を返します。

//emlist[例][ruby]{
h = {1=>"a", 2=>"b", 3=>"c"}

p h.values_at(1,3,4) #=> ["a", "c", nil]
# [h[1], h[3] ,h[4]] と同じ
//}

@see Hash#[] , Hash.new, Hash#default, Hash#default_proc, Array#values_at...

絞り込み条件を変える

CSV::Row#values_at(*headers_and_or_indices) -> Array (3203.0)

与えられた引数に対応する値の配列を返します。

...るこ
とができます。

@return 引数を与えなかった場合は全ての要素を返します。

require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
row = table.first
row.values_at("a", 1, 2..3) # => ["1", "2", "3", nil]...

CGI::QueryExtension::Value#to_a -> Array (3103.0)

@todo

@todo

CGI::QueryExtension::Value#to_ary -> Array (3103.0)

@todo

@todo

Hash#rassoc(value) -> Array | nil (231.0)

ハッシュ内を検索して,引数 value と 一致する値を探します。

...,引数 value と 一致する値を探します。

比較は == メソッドを使用して行われます。一致する値があれば,
該当するキーとその値とを要素とするサイズ 2 の配列を返します。
ない場合には nil を返します。

@param value 探索す...
...る値。

//emlist[例][ruby]{
a = {1=> "one", 2 => "two", 3 => "three", "ii" => "two"}
a.rassoc("two") #=> [2, "two"]
a.rassoc("four") #=> nil
//}

@see Hash#assoc, Array#rassoc...
<< < 1 2 3 4 ... > >>