Module: Selenium::WebDriver::FileReaper Private

Defined in:
build/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 Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.reap(file) ⇒ Object

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.



41
42
43
44
45
46
47
48
49
# File 'build/rb/lib/selenium/webdriver/common/file_reaper.rb', line 41

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

Class Method Details

.<<(file) ⇒ Object

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.



37
38
39
# File 'build/rb/lib/selenium/webdriver/common/file_reaper.rb', line 37

def <<(file)
  tmp_files << file
end

.reap!Object

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.



51
52
53
54
55
56
57
58
# File 'build/rb/lib/selenium/webdriver/common/file_reaper.rb', line 51

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

.reap?Boolean

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)


28
29
30
# File 'build/rb/lib/selenium/webdriver/common/file_reaper.rb', line 28

def reap?
  @reap = defined?(@reap) ? @reap : true
end

.tmp_filesObject

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.



32
33
34
35
# File 'build/rb/lib/selenium/webdriver/common/file_reaper.rb', line 32

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