class Blobsterix::DirectoryList

Public Class Methods

each(path) { |current_path, current_file| ... } click to toggle source
# File lib/blobsterix/helper/directory_list.rb, line 124
def self.each(path)
  a = DirectoryWalker.new(path)
  while a.next
    yield a.current_path, a.current_file
  end
end
each_limit(path, opts={}) { |current_path, current_file| ... } click to toggle source
# File lib/blobsterix/helper/directory_list.rb, line 114
def self.each_limit(path, opts={})
  used = 0
  limit = opts[:limit]||0
  start_path = opts[:start_path]||nil
  a = DirectoryWalker.new(path, :start_path => start_path)
  while (!limit || used < limit) && a.next
    used +=1 if yield a.current_path, a.current_file
  end
  a
end