Class: Selenium::WebDriver::Safari::Extensions::Backup Private

Inherits:
Object
  • Object
show all
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

Constructor Details

#initializeBackup

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_allObject

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