Class: Watir::CookieManager::Dir
- Inherits:
-
Object
- Object
- Watir::CookieManager::Dir
- Defined in:
- lib/watir/cookiemanager.rb
Class Method Summary collapse
-
.rm_rf(dir) ⇒ Object
simulates unix rm -rf command.
- .visit(dir = '.', files_first = false, &block) ⇒ Object
Class Method Details
.rm_rf(dir) ⇒ Object
simulates unix rm -rf command
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/watir/cookiemanager.rb', line 19 def Dir.rm_rf(dir) Dir.visit(dir, true) do |path| if FileTest.directory?(path) begin Dir.unlink(path) rescue # Security Exception for Content.IE end else begin File.unlink(path) rescue #Security exception index.dat etc. end end end end |
.visit(dir = '.', files_first = false, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/watir/cookiemanager.rb', line 9 def Dir.visit(dir = '.', files_first = false, &block) if files_first paths = [] Find.find(dir) { |path| paths << path } paths.reverse_each {|path| yield path} else Find.find(dir, &block) end end |