Class: Mechanize::File

Inherits:
Object
  • Object
show all
Defined in:
lib/mechanize/file.rb

Instance Method Summary collapse

Instance Method Details

#browseObject



2
3
4
5
6
7
8
9
10
11
# File 'lib/mechanize/file.rb', line 2

def browse
  timestamp_string = Time.now.to_f.round(3).to_s.sub('.', '_')
  file_name = timestamp_string + '.html'
  if uri
    file_name = uri.to_s.parameterize + '_' + file_name
  end
  file_path = Pathname.new(ENV['TMPDIR']).join(file_name)
  save(file_path)
  system("open -a 'Google Chrome' 'file://#{file_path}'")
end