Project

General

Profile

Actions

Bug #12814

closed

Pathname#each_child(false) produces unusable file paths

Added by tao (Mr. Tao) over 7 years ago. Updated over 7 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
[ruby-core:77501]

Description

I tried to iterate over items in a directory with each_child testing each item whether it is a directory or not with directory?. This was working just fine until I added false as an argument to each_child.

Pathname.new('.').each_child { |f| p f.realpath } # works as expected
Pathname.new('.').each_child(false) { |f| p f.realpath } # throws an error

As per Ruby doc "By default, the yielded pathnames will have enough information to access the files.", however pathnames yielded with with_directory=false are completely useless as file paths.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0