Project

General

Profile

Actions

Feature #16249

open

Dir#empty? and File#empty?

Added by zverok (Victor Shepelev) over 4 years ago. Updated over 4 years ago.

Status:
Open
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
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0