Ruby 2.3.0 リファレンスマニュアル > ライブラリ一覧 > pathnameライブラリ > Pathnameクラス > each_child
each_child(with_directory = true) -> Enumerator
[permalink][rdoc]each_child(with_directory = true) {|pathname| ...} -> [Pathname]
self.children(with_directory).each と同じです。
require "pathname"
Pathname("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname:/usr/local/etc>
# => #<Pathname:/usr/local/include>
# => #<Pathname:/usr/local/lib>
# => #<Pathname:/usr/local/opt>
# => #<Pathname:/usr/local/sbin>
# => #<Pathname:/usr/local/share>
# => #<Pathname:/usr/local/var>
Pathname("/usr/local").each_child(false) {|f| p f }
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
# => #<Pathname:sbin>
# => #<Pathname:share>
# => #<Pathname:var>
[SEE_ALSO] Pathname#children