Module: Selenium::WebDriver::FileReaper Private

Defined in:
rb/lib/selenium/webdriver/common/file_reaper.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class Method Summary (collapse)

Class Method Details

+ (Object) <<(file)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'rb/lib/selenium/webdriver/common/file_reaper.rb', line 25

def <<(file)
  tmp_files << file
end

+ (Object) reap(file)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
32
33
34
35
36
37
# File 'rb/lib/selenium/webdriver/common/file_reaper.rb', line 29

def reap(file)
  return unless reap?

  unless tmp_files.include?(file)
    raise Error::WebDriverError, "file not added for reaping: #{file.inspect}"
  end

  FileUtils.rm_rf tmp_files.delete(file)
end

+ (Object) reap!

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
42
43
44
45
46
# File 'rb/lib/selenium/webdriver/common/file_reaper.rb', line 39

def reap!
  if reap?
    tmp_files.each { |file| FileUtils.rm_rf(file) }
    true
  else
    false
  end
end

+ (Object) reap=(bool)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
# File 'rb/lib/selenium/webdriver/common/file_reaper.rb', line 11

def reap=(bool)
  @reap = bool
end

+ (Boolean) reap?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


15
16
17
18
# File 'rb/lib/selenium/webdriver/common/file_reaper.rb', line 15

def reap?
  @reap = true unless defined?(@reap)
  !!@reap
end

+ (Object) tmp_files

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
23
# File 'rb/lib/selenium/webdriver/common/file_reaper.rb', line 20

def tmp_files
  @tmp_files ||= Hash.new { |hash, pid| hash[pid] = [] }
  @tmp_files[Process.pid]
end