Sha256: da120b6b7a6d9bc5116f72e51f0228cd5f42ca10ccefd592634a9c10daeb1cf9
Contents?: true
Size: 473 Bytes
Versions: 39
Compression:
Stored size: 473 Bytes
Contents
class Dir ## # Return true if the directory has no children. # # Code found here: http://www.ruby-forum.com/topic/84762 def empty? Dir.glob("#{ path }/*", File::FNM_DOTMATCH) do |e| return false unless %w( . .. ).include?(File::basename(e)) end return true end ## # Return true if the provided path has no children. # # Code found here: http://www.ruby-forum.com/topic/84762 def self.empty? path new(path).empty? end end
Version data entries
39 entries across 39 versions & 1 rubygems