stack_trace-viz 0.5.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b03c766670fab4ee985dec12795b2f7613431e95dc9a942cf435869c244c6f96
4
- data.tar.gz: 686c44ca2cafac934761f83aff6e205bc129ed54d1cffbf30283c931080ce045
3
+ metadata.gz: 259e8ee7fefe6f8b12b9221a6407edb6342a742b46afb092b19bc49753b8e00d
4
+ data.tar.gz: 567ff41d9a93f3575d918a831860a225e77957bff5c0403bec554f713403b06d
5
5
  SHA512:
6
- metadata.gz: 7ca271ae879d596f55f50395ac293ce683e3b5bec2f2315a1245a852d5ee15ea0356e4d8aa960778451e3b85b1c12e73f02ca9ca473139e0c6c76113554f8816
7
- data.tar.gz: 60b8ab414890f2fadb15838c85699326774ea9b9674fe51a125c09376c9242756072924e59e546362e03ea7d4457d0ec7b7c87626466b3ad486aa1731e947363
6
+ metadata.gz: 715ffff46e4da444e333b144705c4f807a618c1db2950f8dfae3645641161afc5d839ce2faaef72a9a8845c3ef60e76c3922ead7dafa4c9cd3f36d1d77ea9e00
7
+ data.tar.gz: 625aec58ac43a4d63727c1b68f4a58e26660fd552e5bdc8d63d208dbf20b20893618c19433cf5ac989de23b0044bb2c46bfc9ddfbff7627260a03d6dbc011d42
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stack_trace-viz (0.5.0)
5
- stack_trace (~> 0.5)
4
+ stack_trace-viz (0.7.0)
5
+ stack_trace (~> 0.7)
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.5.0)
25
+ stack_trace (0.7.0)
26
26
 
27
27
  PLATFORMS
28
28
  arm64-darwin-21
@@ -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") { |f| f.write(content) }
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module StackTrace
4
4
  module Viz
5
- VERSION = "0.5.0"
5
+ VERSION = "0.7.0"
6
6
  end
7
7
  end