ライブラリ
- ビルトイン (212)
キーワード
-
collect
_ concat (22) - detect (22)
-
each
_ cons (22) - find (22)
-
flat
_ map (22) - none? (29)
- one? (29)
- partition (22)
-
slice
_ before (22)
検索結果
先頭5件
-
Enumerable
# collect _ concat -> Enumerator (6201.0) -
各要素をブロックに渡し、その返り値を連結した配列を返します。
各要素をブロックに渡し、その返り値を連結した配列を返します。
ブロックの返り値は基本的に配列を返すべきです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
[[1,2], [3,4]].flat_map{|i| i.map{|j| j*2}} # => [2,4,6,8]
//} -
Enumerable
# collect _ concat {| obj | block } -> Array (6201.0) -
各要素をブロックに渡し、その返り値を連結した配列を返します。
各要素をブロックに渡し、その返り値を連結した配列を返します。
ブロックの返り値は基本的に配列を返すべきです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
[[1,2], [3,4]].flat_map{|i| i.map{|j| j*2}} # => [2,4,6,8]
//} -
Enumerable
# each _ cons(n) -> Enumerator (6201.0) -
要素を重複ありで n 要素ずつに区切り、 ブロックに渡して繰り返します。
...素数より大きな数を与えると、ブロックは一度も実行されません。
//emlist[例][ruby]{
(1..10).each_cons(3){|v| p v }
# => [1, 2, 3]
# [2, 3, 4]
# [3, 4, 5]
# [4, 5, 6]
# [5, 6, 7]
# [6, 7, 8]
# [7, 8, 9]
# [8, 9, 10]
//}
@see Enumerable#each_slice... -
Enumerable
# each _ cons(n) {|list| . . . } -> nil (6201.0) -
要素を重複ありで n 要素ずつに区切り、 ブロックに渡して繰り返します。
...素数より大きな数を与えると、ブロックは一度も実行されません。
//emlist[例][ruby]{
(1..10).each_cons(3){|v| p v }
# => [1, 2, 3]
# [2, 3, 4]
# [3, 4, 5]
# [4, 5, 6]
# [5, 6, 7]
# [6, 7, 8]
# [7, 8, 9]
# [8, 9, 10]
//}
@see Enumerable#each_slice... -
Enumerable
# each _ cons(n) {|list| . . . } -> self (6201.0) -
要素を重複ありで n 要素ずつに区切り、 ブロックに渡して繰り返します。
...素数より大きな数を与えると、ブロックは一度も実行されません。
//emlist[例][ruby]{
(1..10).each_cons(3){|v| p v }
# => [1, 2, 3]
# [2, 3, 4]
# [3, 4, 5]
# [4, 5, 6]
# [5, 6, 7]
# [6, 7, 8]
# [7, 8, 9]
# [8, 9, 10]
//}
@see Enumerable#each_slice... -
Enumerable
# none? -> bool (6201.0) -
ブロックを指定しない場合は、 Enumerable オブジェクトのすべての 要素が偽であれば真を返します。そうでなければ偽を返します。
...ブロックを指定しない場合は、 Enumerable オブジェクトのすべての
要素が偽であれば真を返します。そうでなければ偽を返します。
ブロックを指定した場合は、Enumerable オブジェクトのすべての要素を
ブロックで評価した結......'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set[].none? # => true
Set[nil].none? # => true
Set[nil,false].none?......# => true
Set[nil, false, true].none? # => false
//}......', 'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set['ant', 'bear', 'cat'].none?(/d/) # => true
Set[].none? # => true
Set[nil].none?......# => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}......# => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}
@see Array#none?... -
Enumerable
# none? {|obj| . . . } -> bool (6201.0) -
ブロックを指定しない場合は、 Enumerable オブジェクトのすべての 要素が偽であれば真を返します。そうでなければ偽を返します。
...ブロックを指定しない場合は、 Enumerable オブジェクトのすべての
要素が偽であれば真を返します。そうでなければ偽を返します。
ブロックを指定した場合は、Enumerable オブジェクトのすべての要素を
ブロックで評価した結......'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set[].none? # => true
Set[nil].none? # => true
Set[nil,false].none?......# => true
Set[nil, false, true].none? # => false
//}......', 'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set['ant', 'bear', 'cat'].none?(/d/) # => true
Set[].none? # => true
Set[nil].none?......# => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}......# => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}
@see Array#none?... -
Enumerable
# none?(pattern) -> bool (6201.0) -
ブロックを指定しない場合は、 Enumerable オブジェクトのすべての 要素が偽であれば真を返します。そうでなければ偽を返します。
...ブロックを指定しない場合は、 Enumerable オブジェクトのすべての
要素が偽であれば真を返します。そうでなければ偽を返します。
ブロックを指定した場合は、Enumerable オブジェクトのすべての要素を
ブロックで評価した結......', 'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set['ant', 'bear', 'cat'].none?(/d/) # => true
Set[].none? # => true
Set[nil].none?......# => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}......# => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}
@see Array#none?... -
Enumerable
# one? -> bool (6201.0) -
ブロックを指定しない場合は、 Enumerable オブジェクトの要素のうち ちょうど一つだけが真であれば、真を返します。 そうでなければ偽を返します。
...ブロックを指定しない場合は、 Enumerable オブジェクトの要素のうち
ちょうど一つだけが真であれば、真を返します。
そうでなければ偽を返します。
ブロックを指定した場合は、Enumerable オブジェクトの要素を
ブロックで......'ant', 'bear', 'cat'].one? {|word| word.length == 4} # => true
Set['ant', 'bear', 'cat'].one? {|word| word.length > 4} # => false
Set[nil, true, 99].one? # => false
Set[nil, true, false].one? # => true
Set[].one?......bear', 'cat'].one? {|word| word.length == 4} # => true
Set['ant', 'bear', 'cat'].one? {|word| word.length > 4} # => false
Set['ant', 'bear', 'cat'].one?(/t/) # => false
Set[nil, true, 99].one? # => false
Set[nil, true, false].one?......# => true
Set[nil, true, 99].one?(Integer) # => true
Set[].one? # => false
//}......# => true
Set[nil, true, 99].one?(Integer) # => true
Set[].one? # => false
//}
@see Array#one?... -
Enumerable
# one? {|obj| . . . } -> bool (6201.0) -
ブロックを指定しない場合は、 Enumerable オブジェクトの要素のうち ちょうど一つだけが真であれば、真を返します。 そうでなければ偽を返します。
...ブロックを指定しない場合は、 Enumerable オブジェクトの要素のうち
ちょうど一つだけが真であれば、真を返します。
そうでなければ偽を返します。
ブロックを指定した場合は、Enumerable オブジェクトの要素を
ブロックで......'ant', 'bear', 'cat'].one? {|word| word.length == 4} # => true
Set['ant', 'bear', 'cat'].one? {|word| word.length > 4} # => false
Set[nil, true, 99].one? # => false
Set[nil, true, false].one? # => true
Set[].one?......bear', 'cat'].one? {|word| word.length == 4} # => true
Set['ant', 'bear', 'cat'].one? {|word| word.length > 4} # => false
Set['ant', 'bear', 'cat'].one?(/t/) # => false
Set[nil, true, 99].one? # => false
Set[nil, true, false].one?......# => true
Set[nil, true, 99].one?(Integer) # => true
Set[].one? # => false
//}......# => true
Set[nil, true, 99].one?(Integer) # => true
Set[].one? # => false
//}
@see Array#one?... -
Enumerable
# one?(pattern) -> bool (6201.0) -
ブロックを指定しない場合は、 Enumerable オブジェクトの要素のうち ちょうど一つだけが真であれば、真を返します。 そうでなければ偽を返します。
...ブロックを指定しない場合は、 Enumerable オブジェクトの要素のうち
ちょうど一つだけが真であれば、真を返します。
そうでなければ偽を返します。
ブロックを指定した場合は、Enumerable オブジェクトの要素を
ブロックで......bear', 'cat'].one? {|word| word.length == 4} # => true
Set['ant', 'bear', 'cat'].one? {|word| word.length > 4} # => false
Set['ant', 'bear', 'cat'].one?(/t/) # => false
Set[nil, true, 99].one? # => false
Set[nil, true, false].one?......# => true
Set[nil, true, 99].one?(Integer) # => true
Set[].one? # => false
//}
@see Array#one?...