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.



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_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.



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