Over a million developers have joined DZone.

Pathname#empty?

·
This should just be part of Pathname.


class Pathname
  # Returns true if the Pathname is a directory and contains no files or directories.
  def empty?
    self.directory? && self.entries.find_all {|f| f.to_s !~ /^\.\.?$/ }.empty? 
  end
end
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}