種類
- インスタンスメソッド (199)
- 特異メソッド (22)
- クラス (11)
クラス
- Array (11)
- Data (6)
-
Enumerator
:: Lazy (44) - Hash (22)
- Struct (105)
モジュール
- Enumerable (33)
検索結果
先頭5件
-
Enumerator
:: Lazy # zip(*lists) -> Enumerator :: Lazy (29250.0) -
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
...
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
ただし一貫性のため、ブロック付きで呼び出した場合は Enumerable#zip と
同じ挙動になります。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #......<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>
1.step.lazy.zip(('a'..'z').cycle).take(30).force.last(6)
# => [[25, "y"], [26, "z"], [27, "a"], [28, "b"], [29, "c"], [30, "d"]]
//}
@see Enumerable#zip... -
Enumerable
# zip(*lists) -> [[object]] (29228.0) -
self と引数に渡した配列の各要素からなる配列の配列を生成して返します。 生成される配列の要素数は self の要素数と同じです。
...self と引数に渡した配列の各要素からなる配列の配列を生成して返します。
生成される配列の要素数は self の要素数と同じです。
ブロック付きで呼び出した場合は、
self と引数に渡した配列の各要素を順番にブロックに渡......to_ary メソッドが無い場合は each を試します。
//emlist[例][ruby]{
p (1..3).zip([4,5,6], [7,8,9])
# => [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
p (1..2).zip([:a,:b,:c], [:A,:B,:C,:D])
# => a, :A], [2, :b, :B
p (1..5).zip([:a,:b,:c], [:A,:B,:C,:D])
# => [[1, :a, :A], [2, :b,......:B],
# [3, :c, :C], [4, nil, :D], [5, nil, nil]]
//}
//emlist[例][ruby]{
p [1,2,3].zip([4,5,6], [7,8,9]) {|ary|
p ary
}
# => [1, 4, 7]
# [2, 5, 8]
# [3, 6, 9]
# nil
//}... -
Enumerator
:: Lazy # zip(*lists) {|v1 , v2 , . . . | . . . } -> nil (29150.0) -
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
...
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
ただし一貫性のため、ブロック付きで呼び出した場合は Enumerable#zip と
同じ挙動になります。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #......<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>
1.step.lazy.zip(('a'..'z').cycle).take(30).force.last(6)
# => [[25, "y"], [26, "z"], [27, "a"], [28, "b"], [29, "c"], [30, "d"]]
//}
@see Enumerable#zip... -
Enumerable
# zip(*lists) {|v1 , v2 , . . . | . . . } -> nil (29128.0) -
self と引数に渡した配列の各要素からなる配列の配列を生成して返します。 生成される配列の要素数は self の要素数と同じです。
...self と引数に渡した配列の各要素からなる配列の配列を生成して返します。
生成される配列の要素数は self の要素数と同じです。
ブロック付きで呼び出した場合は、
self と引数に渡した配列の各要素を順番にブロックに渡......to_ary メソッドが無い場合は each を試します。
//emlist[例][ruby]{
p (1..3).zip([4,5,6], [7,8,9])
# => [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
p (1..2).zip([:a,:b,:c], [:A,:B,:C,:D])
# => a, :A], [2, :b, :B
p (1..5).zip([:a,:b,:c], [:A,:B,:C,:D])
# => [[1, :a, :A], [2, :b,......:B],
# [3, :c, :C], [4, nil, :D], [5, nil, nil]]
//}
//emlist[例][ruby]{
p [1,2,3].zip([4,5,6], [7,8,9]) {|ary|
p ary
}
# => [1, 4, 7]
# [2, 5, 8]
# [3, 6, 9]
# nil
//}... -
Array
# zip(*lists) -> [[object]] (26228.0) -
自身と引数に渡した配列の各要素からなる配列の配列を生成して返します。 生成される配列の要素数は self の要素数と同じです。
...各要素からなる配列の配列を生成して返します。
生成される配列の要素数は self の要素数と同じです。
ブロック付きで呼び出した場合は、
self と引数に渡した配列の各要素を順番にブロックに渡します。
@param lists 配列を......合は each メソッドによる暗黙の型変換を試みます。
@raise TypeError 引数に配列以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
p [1,2,3].zip([4,5,6], [7,8,9])
# =>......[[1, 4, 7], [2, 5, 8], [3, 6, 9]]
p [1,2].zip([:a,:b,:c], [:A,:B,:C,:D])
# => a, :A], [2, :b, :B
p [1,2,3,4,5].zip([:a,:b,:c], [:A,:B,:C,:D])
# => [[1, :a, :A], [2, :b, :B],
# [3, :c, :C], [4, nil, :D], [5, nil, nil]]
p [1,2,3].zip([4,5,6], [7,8,9]) { |ary| p ary }
# => [1, 4, 7]
# [2, 5,... -
Enumerator
:: Lazy # take _ while -> Enumerator :: Lazy (14144.0) -
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
...
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a"........"z":cycle>)>:take_while>
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }.force.last(5)
# => [[99995, "y"], [99996, "z"], [99997, "a"], [99998, "b"], [99999, "c"]]
//}
@see Enumerable#take_while... -
Enumerator
:: Lazy # take _ while {|item| . . . } -> Enumerator :: Lazy (14144.0) -
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
...
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a"........"z":cycle>)>:take_while>
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }.force.last(5)
# => [[99995, "y"], [99996, "z"], [99997, "a"], [99998, "b"], [99999, "c"]]
//}
@see Enumerable#take_while... -
Data
# inspect -> String (14114.0) -
self の内容を人間に読みやすい文字列にして返します。
...self の内容を人間に読みやすい文字列にして返します。
//emlist[例][ruby]{
Customer = Data.define(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
joe.inspect # => "#<data Customer name=\"Joe Smith\", address=\"123 Maple, Anytown NC\", zip=......12345>"
//}
[注意] 本メソッドの記述は Data のサブクラスのインスタンスに対して呼び
出す事を想定しています。Data.define は Data のサブクラスを作成する点に
注意してください。... -
Struct
# inspect -> String (14114.0) -
self の内容を人間に読みやすい文字列にして返します。
...self の内容を人間に読みやすい文字列にして返します。
[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してくださ......い。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
joe.inspect # => "#<struct Customer name=\"Joe Smith\", address=\"123 Maple, Anytown NC\", zip=12345>"
//}... -
Struct
# each -> Enumerator (14108.0) -
構造体の各メンバに対して繰り返します。
...ます。Struct.new は Struct の下位クラスを作成する点に
注意してください。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
joe.each {|x| puts(x) }
# => Joe Smith
# 123 Maple, Anytown NC
#...