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

Inherits:
Object
  • Object
show all
Defined in:
rb/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

- (Backup) initialize

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



145
146
147
148
149
150
# File 'rb/lib/selenium/webdriver/safari/extensions.rb', line 145

def initialize
  @dir     = Pathname.new(Dir.mktmpdir('webdriver-safari-backups'))
  @backups = {}

  FileReaper << @dir.to_s
end

Instance Method Details

- (Object) backup(file)

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.



152
153
154
155
156
157
158
# File 'rb/lib/selenium/webdriver/safari/extensions.rb', line 152

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

- (Object) restore_all

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.



160
161
162
# File 'rb/lib/selenium/webdriver/safari/extensions.rb', line 160

def restore_all
  @backups.each {|src, dst| FileUtils.cp_r dst.to_s, src.to_s }
end