Class: Dump
- Inherits:
-
Object
- Object
- Dump
- Defined in:
- lib/stackprof-webnav/dump.rb
Instance Attribute Summary collapse
-
#flamegraph_json ⇒ Object
Returns the value of attribute flamegraph_json.
-
#graph_data ⇒ Object
Returns the value of attribute graph_data.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #check_checksum! ⇒ Object
- #checksum ⇒ Object
- #content ⇒ Object
- #flame_graph_path ⇒ Object
- #graph_image_path ⇒ Object
- #graph_path ⇒ Object
-
#initialize(path) ⇒ Dump
constructor
A new instance of Dump.
Constructor Details
#initialize(path) ⇒ Dump
Returns a new instance of Dump.
4 5 6 |
# File 'lib/stackprof-webnav/dump.rb', line 4 def initialize(path) @path = path end |
Instance Attribute Details
#flamegraph_json ⇒ Object
Returns the value of attribute flamegraph_json.
3 4 5 |
# File 'lib/stackprof-webnav/dump.rb', line 3 def flamegraph_json @flamegraph_json end |
#graph_data ⇒ Object
Returns the value of attribute graph_data.
3 4 5 |
# File 'lib/stackprof-webnav/dump.rb', line 3 def graph_data @graph_data end |
#path ⇒ Object
Returns the value of attribute path.
2 3 4 |
# File 'lib/stackprof-webnav/dump.rb', line 2 def path @path end |
Instance Method Details
#check_checksum! ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/stackprof-webnav/dump.rb', line 21 def check_checksum! return unless @checksum if Digest::SHA1.file(@path) != checksum puts "\n\nFile reloaded" @checksum, @content = nil, nil end end |
#checksum ⇒ Object
8 9 10 |
# File 'lib/stackprof-webnav/dump.rb', line 8 def checksum @checksum ||= Digest::SHA1.file(@path) end |
#content ⇒ Object
12 13 14 |
# File 'lib/stackprof-webnav/dump.rb', line 12 def content @content ||= File.open(@path).read end |
#flame_graph_path ⇒ Object
30 31 32 |
# File 'lib/stackprof-webnav/dump.rb', line 30 def flame_graph_path @path + ".#{checksum}.flames.json" end |
#graph_image_path ⇒ Object
38 39 40 |
# File 'lib/stackprof-webnav/dump.rb', line 38 def graph_image_path @path + ".#{checksum}.graph.png" end |
#graph_path ⇒ Object
34 35 36 |
# File 'lib/stackprof-webnav/dump.rb', line 34 def graph_path @path + ".#{checksum}.digraph.dot" end |