Project

General

Profile

Feature #16249

Dir#empty? and File#empty?

Added by zverok (Victor Shepelev) about 1 year ago. Updated about 1 year ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:95306]

Description

I don't think it is a super-valuable addition (as nobody complained about it, or I can't find similar proposals), but seems logical to me:

# Existed since 2.4
Dir.empty?('dirname') #=> true/false
File.empty?('filename') # => true/false

# Proposed and implemented:
Dir.open('dirname').empty?
File.open('filename').empty?

Files

file_dir_i_empty.patch (3.27 KB) file_dir_i_empty.patch zverok (Victor Shepelev), 10/12/2019 09:47 AM

Also available in: Atom PDF