Sha256: 5b32d70a3dd474d71644ad23d997490e41a7f760186b37c436b9468d426885d1

Contents?: true

Size: 699 Bytes

Versions: 3

Compression:

Stored size: 699 Bytes

Contents

class Dump
  attr_reader :path
  attr_accessor :flamegraph_json, :graph_data
  def initialize(path)
    @path = path
  end

  def checksum
    @checksum ||= Digest::SHA1.file(@path)
  end

  def content
    @content ||= File.open(@path).read
  end

  def path=(new_path)
    @path = new_path
    check_checksum!
  end

  def check_checksum!
    return unless @checksum

    if Digest::SHA1.file(@path) != checksum
      puts "\n\nFile reloaded"
      @checksum, @content = nil, nil
    end
  end

  def flame_graph_path
    @path + ".#{checksum}.flames.json"
  end

  def graph_path
    @path + ".#{checksum}.digraph.dot"
  end

  def graph_image_path
    @path + ".#{checksum}.graph.svg"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stackprof-webnav-1.0.4 lib/stackprof-webnav/dump.rb
stackprof-webnav-1.0.3 lib/stackprof-webnav/dump.rb
stackprof-webnav-1.0.2 lib/stackprof-webnav/dump.rb