Sha256: f88555ceb24573d52ab060196825a6c2f7874958611408152df66bf643878158

Contents?: true

Size: 513 Bytes

Versions: 3

Compression:

Stored size: 513 Bytes

Contents

class Dir
  def self.children(path, flag=0)
    c = self.glob(File.join(path, '*'), flag).reject{|f| f=~/\/\.+$/}
    return block_given? ? c.each(&Proc.new) : c
  end

  def self.each_leaf(path, flag=0, nofollow=false, block=nil)
    block = Proc.new if block_given?
    if (!nofollow || !File.symlink?(path)) && File.directory?(path)
      self.children(path, flag) do |child|
        self.each_leaf(child, flag, nofollow, block) # recursive
      end
    else
      block && block.call(path)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gnn-rblibs-0.0.4 lib/dir/each_leaf.rb
gnn-rblibs-0.0.3 lib/dir/each_leaf.rb
gnn-rblibs-0.0.1 lib/dir/each_leaf.rb