Method: WebSnap::Snapper#to_file

Defined in:
lib/websnap/websnap.rb

#to_file(path, image_path = nil) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/websnap/websnap.rb', line 55

def to_file(path, image_path=nil)
  append_stylesheets
  path = File.expand_path(path)

  @source = Source.new(@source.to_s.gsub(/images\//, image_path)) unless image_path.nil?
  File.open(path,'w') {|file| file << self.to_bytes}
end