Sha256: 4a155f49c68621ae9cc5df412b115a1c14ffe69fe51b152d27d65045050ce78e

Contents?: true

Size: 804 Bytes

Versions: 11

Compression:

Stored size: 804 Bytes

Contents

module Selenium
  module WebDriver
    module FileReaper

      class << self
        def reap=(bool)
          @reap = bool
        end

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

        def tmp_files
          @tmp_files ||= []
        end

        def <<(file)
          tmp_files << file
        end

        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

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

      at_exit { reap! }

    end # FileReaper
  end # WebDriver
end # Selenium

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
selenium-webdriver-2.0.0 lib/selenium/webdriver/common/file_reaper.rb
selenium-webdriver-0.2.2 lib/selenium/webdriver/common/file_reaper.rb
selenium-webdriver-0.2.1 lib/selenium/webdriver/common/file_reaper.rb
selenium-webdriver-0.2.0 lib/selenium/webdriver/common/file_reaper.rb
selenium-webdriver-0.2.0.dev lib/selenium/webdriver/common/file_reaper.rb
selenium-webdriver-0.1.4 lib/selenium/webdriver/common/file_reaper.rb
selenium-webdriver-0.1.3 lib/selenium/webdriver/common/file_reaper.rb
selenium-webdriver-0.1.3.dev lib/selenium/webdriver/common/file_reaper.rb
selenium-webdriver-0.1.2 lib/selenium/webdriver/common/file_reaper.rb
selenium-webdriver-0.1.1 lib/selenium/webdriver/common/file_reaper.rb
selenium-webdriver-0.1.0 lib/selenium/webdriver/common/file_reaper.rb