Class: Watirmark::Screenshot::Master

Inherits:
Current show all
Defined in:
lib/watirmark/screenshot.rb

Instance Attribute Summary

Attributes inherited from Current

#filename, #screenheight, #screenwidth

Instance Method Summary collapse

Methods inherited from Current

#get_screen_size, #md5, #revert_window_size, #take_screen_shot, #update_window_size

Constructor Details

#initialize(filename, screenshot) ⇒ Master

Returns a new instance of Master.



108
109
110
111
# File 'lib/watirmark/screenshot.rb', line 108

def initialize(filename, screenshot)
  @filename = filename
  update(screenshot) if Watirmark::Configuration.instance.create_master_snapshots
end

Instance Method Details

#update(screenshot) ⇒ Object



113
114
115
116
117
118
# File 'lib/watirmark/screenshot.rb', line 113

def update(screenshot)
  FileUtils.mkdir_p(File.dirname(@filename))
  File.unlink(@filename) if File.exists?(@filename)
  FileUtils.copy_file(screenshot.filename, @filename)
  Watirmark.logger.info "Created new master: #@filename"
end