Class: Selenium::WebDriver::Safari::Extensions::Backup Private
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Safari::Extensions::Backup
- Defined in:
- lib/selenium/webdriver/safari/extensions.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #backup(file) ⇒ Object private
-
#initialize ⇒ Backup
constructor
private
A new instance of Backup.
- #restore_all ⇒ Object private
Constructor Details
#initialize ⇒ Backup
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 a new instance of Backup.
147 148 149 150 151 152 |
# File 'lib/selenium/webdriver/safari/extensions.rb', line 147 def initialize @dir = Pathname.new(Dir.mktmpdir('webdriver-safari-backups')) @backups = {} FileReaper << @dir.to_s end |
Instance Method Details
#backup(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.
154 155 156 157 158 159 160 |
# File 'lib/selenium/webdriver/safari/extensions.rb', line 154 def backup(file) src = file dst = @dir.join(file.basename).to_s FileUtils.cp_r src.to_s, dst.to_s @backups[src] = dst end |
#restore_all ⇒ 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.
162 163 164 |
# File 'lib/selenium/webdriver/safari/extensions.rb', line 162 def restore_all @backups.each {|src, dst| FileUtils.cp_r dst.to_s, src.to_s } end |