42件ヒット
[1-42件を表示]
(0.019秒)
種類
- インスタンスメソッド (21)
- クラス (11)
- 文書 (10)
ライブラリ
- ビルトイン (32)
クラス
-
Enumerator
:: Lazy (10)
モジュール
- Enumerable (11)
キーワード
- Lazy (11)
-
NEWS for Ruby 2
. 2 . 0 (10) -
chunk
_ while (11)
検索結果
先頭4件
-
Enumerator
:: Lazy # slice _ when {|elt _ before , elt _ after| bool } -> Enumerator :: Lazy (18147.0) -
Enumerable#slice_when と同じですが、配列ではなく Enumerator::Lazy を返します。
...e#slice_when と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_when { |i, j| (i + j) % 5 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007fce84118348>:each>>
1.step.lazy.slice_when { |i, j| (i + j) % 5 ==......0 }.take(5).force
# => [[1, 2], [3, 4, 5, 6, 7], [8, 9, 10, 11, 12], [13, 14, 15, 16, 17], [18, 19, 20, 21, 22]]
//}
@see Enumerable#slice_when... -
Enumerable
# chunk _ while {|elt _ before , elt _ after| . . . } -> Enumerator (24.0) -
要素を前から順にブロックで評価し、その結果によって要素をチャンクに分け た(グループ化した)要素を持つEnumerator を返します。
...。
//emlist[例][ruby]{
# 1ずつ増加する部分配列ごとに分ける。
a = [1,2,4,9,10,11,12,15,16,19,20,21]
b = a.chunk_while {|i, j| i+1 == j }
p b.to_a # => [[1, 2], [4], [9, 10, 11, 12], [15, 16], [19, 20, 21]]
c = b.map {|a| a.length < 3 ? a : "#{a.first}-#{a.last}" }
p c # => [[1, 2]......4, 2, 0]
p a.chunk_while {|i, j| i.even? == j.even? }.to_a
# => [[7, 5, 9], [2, 0], [7, 9], [4, 2, 0]]
//}
Enumerable#slice_when はブロックの戻り値が真ではなく偽の時に要素
を分ける事を除いて同じ処理を行います。
@see Enumerable#slice_when, Enumerable#chunk... -
Enumerator
:: Lazy (12.0) -
map や select などのメソッドの遅延評価版を提供するためのクラス。
...map/collect
* flat_map/collect_concat
* select/find_all
* reject
* grep
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice_when
* chunk
* zip (※互換性のため、ブロックを渡さないケースのみlazy)
Lazyオブジェクトは、Enumerable#lazyメソッ......、
# 巨大な配列を確保しようとしてメモリを使い切ったりはしない
open("log.txt"){|f|
f.each_line.lazy.map{|line|
Hash[line.split(/\t/).map{|s| s.split(/:/, 2)}]
}.select{|hash|
hash["req"] =~ /GET/ && hash["status"] == "200"
}.each{|hash|
p hash
}
}
//}......ect
* flat_map/collect_concat
* select/find_all
* reject
* grep, grep_v
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice_when
* chunk
* zip (※互換性のため、ブロックを渡さないケースのみlazy)
Lazyオブジェクトは、Enumerable#lazyメソッ......ect
* flat_map/collect_concat
* select/find_all
* reject
* grep, grep_v
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice_when
* chunk, chunk_while
* uniq
* zip (※互換性のため、ブロックを渡さないケースのみlazy)
Lazyオブジェクトは、Enum......p/collect_concat
* filter_map
* select/find_all
* reject
* grep, grep_v
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice_when
* chunk, chunk_while
* uniq
* zip (※互換性のため、ブロックを渡さないケースのみlazy)
Lazyオブジェクトは、Enum......p/collect_concat
* filter_map
* select/find_all
* reject
* grep, grep_v
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice_when
* chunk, chunk_while
* uniq
* compact
* zip (※互換性のため、ブロックを渡さないケースのみlazy)
Lazyオブジェク... -
NEWS for Ruby 2
. 2 . 0 (12.0) -
NEWS for Ruby 2.2.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...共に書かれた全ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 2.1.0 以降の変更
=== 言語仕様の変更
* nil/true/false
* nil/true/false はフリーズされました 8923
* Hash リテラル
* 後ろ......を修正しました。 9593
=== 組み込みクラスの更新
* Binding
* 追加: Binding#local_variables
* 追加: Binding#receiver
* Dir
* 追加: Dir#fileno
* Enumerable
* 追加: Enumerable#slice_after
* 追加: Enumerable#slice_when
* 拡張: Enumerable#min,......クトを返します
* 追加: Method#super_method はスーパクラスの同名のメソッドの Method オブジェクトを返します。
=== 組み込みクラスの互換性 (機能追加とバグ修正を除く)
* Enumerable
* Enumerable#slice_before の状態管理は非推奨...