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.
164 165 166 167 168 169 |
# File 'lib/selenium/webdriver/safari/extensions.rb', line 164 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.
171 172 173 174 175 176 177 |
# File 'lib/selenium/webdriver/safari/extensions.rb', line 171 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.
179 180 181 |
# File 'lib/selenium/webdriver/safari/extensions.rb', line 179 def restore_all @backups.each {|src, dst| FileUtils.cp_r dst.to_s, src.to_s } end |