< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Feature #3608: Enhancing Pathname#each_child to be lazy
http://redmine.ruby-lang.org/issues/show/3608
Author: Tomasz Wegrzanowski
Status: Open, Priority: Normal
Right now it lists entire directory, then yields
every element, that is x.each_child(&b) means x.children.each(&b).
This is too slow for directories mounted over networked file systems etc.,
and there is currently no way to get lazy behaviour, other than leaving
convenient #each_child/#children API and moving to lower level.
With this patch:
* #children is eager like before, no change here
* #each_child becomes lazy
* #each_child without block returns lazy enumerator,
so it can be used like this dir.each_child.find(&:symlink?)
without losing laziness.
Patch is against trunk. pathname.rb was in lib/ not ext/pathname/lib/
before, but it works either way.
The part to return enumerator when called without a block wouldn't
work in 1.8. If backport is desired, that line would need to be thrown
away, and #children would need to build result array instead
of calling each_child(with_directory).to_a - this would be straightforward.
----------------------------------------
http://redmine.ruby-lang.org