Module: StackProf::Remote::ReportSaver

Defined in:
lib/stackprof/remote/middleware.rb

Class Method Summary collapse

Class Method Details

.marshaled_resultsObject



69
70
71
72
73
# File 'lib/stackprof/remote/middleware.rb', line 69

def self.marshaled_results
  if results = StackProf.results
    Marshal.dump(results)
  end
end

.save(base_path) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/stackprof/remote/middleware.rb', line 75

def self.save(base_path)
  if results = marshaled_results
    FileUtils.mkdir_p(base_path)
    filename = "stackprof-#{Process.pid}-#{Time.now.to_i}.dump"
    path     = File.expand_path(File.join(base_path, filename))
    File.open(path, 'wb') do |f|
      f.write results
    end
    path
  end
end