module DebugHTML

Public Class Methods

save(html) click to toggle source
# File lib/debug_html.rb, line 5
def self.save(html)
  save_html(html)
end
save_and_open(html) click to toggle source
# File lib/debug_html.rb, line 9
def self.save_and_open(html)
  path = save_html(html)
  Launchy.open(path)
end

Private Class Methods

filename() click to toggle source
# File lib/debug_html.rb, line 27
def self.filename
  timestamp = Time.new.strftime('%Y%m%d%H%M%S')
  "debug_html-#{timestamp}#{rand(10**10)}.html"
end
full_path() click to toggle source
# File lib/debug_html.rb, line 22
def self.full_path
  tmpdir = Dir.tmpdir
  "#{tmpdir}/#{filename}"
end
save_html(html) click to toggle source
# File lib/debug_html.rb, line 14
def self.save_html(html)
  file = File.new(full_path, 'w')
  file.write(html)
  file.close

  file.path
end