lib/io_streams/paths/file.rb in iostreams-1.9.0 vs lib/io_streams/paths/file.rb in iostreams-1.10.0
- old
+ new
@@ -87,9 +87,14 @@
# "**.rb" "main.rb" true
# "**.rb" "./main.rb" false
# "**.rb" "lib/song.rb" true
# "*" "dave/.profile" true
def each_child(pattern = "*", case_sensitive: false, directories: false, hidden: false)
+ unless block_given?
+ return to_enum(__method__, pattern,
+ case_sensitive: case_sensitive, directories: directories, hidden: hidden)
+ end
+
flags = 0
flags |= ::File::FNM_CASEFOLD unless case_sensitive
flags |= ::File::FNM_DOTMATCH if hidden
# Dir.each_child("testdir") {|x| puts "Got #{x}" }