Module: Selenium::WebDriver::FileReaper Private

Defined in:
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

.<<(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.


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

def <<(file)
  tmp_files << file
end

.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.


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

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

.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.


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

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

.reap=(bool) ⇒ 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.


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

def reap=(bool)
  @reap = bool
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)

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

def reap?
  @reap = true unless defined?(@reap)
  !!@reap
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.


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

def tmp_files
  @tmp_files ||= []
end