class Gio::FileEnumerator

Public Instance Methods

each(cancellable = nil) { |file| ... } click to toggle source
# File lib/gio2.rb, line 83
def each(cancellable = nil)
  return self.enum_for unless block_given?
  while file = next_file(cancellable)
    yield file
  end
  close
  self
end
each_async(num_files, io_priority = GLib::PRIORITY_DEFAULT, cancellable = nil, &block) click to toggle source

TODO: Return Enumerator unless block_given?

# File lib/gio2.rb, line 93
def each_async(num_files, io_priority = GLib::PRIORITY_DEFAULT, cancellable = nil, &block)
  each_async_loop num_files, io_priority, cancellable, block
end

Private Instance Methods

each_async_loop(num_files, io_priority, cancellable, block) click to toggle source
# File lib/gio2.rb, line 99
def each_async_loop(num_files, io_priority, cancellable, block)
  next_files_async num_files, io_priority, cancellable do |result|
    files = next_files_finish(result)
    files.each do |file|
      block.call file
    end
    if files.length > 0
      each_async_loop num_files, io_priority, cancellable, block
    else
      close
    end
  end
end