stack_trace-viz 0.4.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/stack_trace/viz/html.rb +11 -2
- data/lib/stack_trace/viz/version.rb +1 -1
- data/public/main.html.erb +1 -1
- data/stack_trace-viz.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42aac288cc2c4d40340ae00490ed8eeb025c17200d31b5ab0fde80a38d780093
|
4
|
+
data.tar.gz: fddafe8f31e49a4bd24a6aba943f13425259b4b30dc4af170e2a8b8994652cbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c1fe8e3e4ff969947770b857e156a000d83970231f63ddb8ccaaa15e768ce077f08a255c845cf5ee4297064495115df3392f9d468f2cbe29a2410ca1204a0b5
|
7
|
+
data.tar.gz: 55290742c95b7fdbcb8c6fd550b4e5ba39397572d92c49e33ae24af7d91d1546b393ba88f13579efb3dd37f3030a10376fcdf0f3ebe0c3139c00958c427469d2
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stack_trace-viz (0.
|
5
|
-
stack_trace (~> 0.
|
4
|
+
stack_trace-viz (0.6.0)
|
5
|
+
stack_trace (~> 0.6)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
diff-lcs (>= 1.2.0, < 2.0)
|
23
23
|
rspec-support (~> 3.12.0)
|
24
24
|
rspec-support (3.12.0)
|
25
|
-
stack_trace (0.
|
25
|
+
stack_trace (0.6.0)
|
26
26
|
|
27
27
|
PLATFORMS
|
28
28
|
arm64-darwin-21
|
data/lib/stack_trace/viz/html.rb
CHANGED
@@ -3,11 +3,14 @@
|
|
3
3
|
require "erb"
|
4
4
|
require "json"
|
5
5
|
require "securerandom"
|
6
|
+
require "stringio"
|
6
7
|
|
7
8
|
module StackTrace
|
8
9
|
module Viz
|
9
10
|
class HTML
|
10
11
|
LAYOUT_FILE = "../../public/main.html.erb"
|
12
|
+
MAX_WRITE_BYTES = 64
|
13
|
+
MAX_JSON_NESTING = 1_000
|
11
14
|
|
12
15
|
def initialize
|
13
16
|
@traces = []
|
@@ -16,7 +19,9 @@ module StackTrace
|
|
16
19
|
def save(file_path)
|
17
20
|
file_path ||= default_file_path
|
18
21
|
|
19
|
-
File.open(file_path, "w")
|
22
|
+
File.open(file_path, "w") do |f|
|
23
|
+
content_io.each_line(MAX_WRITE_BYTES) { |chunk| f.write(chunk) }
|
24
|
+
end
|
20
25
|
|
21
26
|
file_path
|
22
27
|
end
|
@@ -33,12 +38,16 @@ module StackTrace
|
|
33
38
|
|
34
39
|
attr_reader :traces
|
35
40
|
|
41
|
+
def content_io
|
42
|
+
StringIO.new(content)
|
43
|
+
end
|
44
|
+
|
36
45
|
def content
|
37
46
|
erb.result_with_hash({ trace_data: trace_data })
|
38
47
|
end
|
39
48
|
|
40
49
|
def trace_data
|
41
|
-
JSON.generate(traces)
|
50
|
+
JSON.generate(traces, max_nesting: MAX_JSON_NESTING)
|
42
51
|
end
|
43
52
|
|
44
53
|
def erb
|