[ruby-core:95306] [Ruby master Feature#16249] Dir#empty? and File#empty?
From:
zverok.offline@...
Date:
2019-10-12 09:48:22 UTC
List:
ruby-core #95306
Issue #16249 has been reported by zverok (Victor Shepelev).
----------------------------------------
Feature #16249: Dir#empty? and File#empty?
https://bugs.ruby-lang.org/issues/16249
* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
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:
```ruby
# 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)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>