stack_trace-viz 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 416cfb29b94301c68140f969701fd52243672195bcb3775a8a56d9230ca5f95c
4
- data.tar.gz: 7eee489e590bfebf8f08d9a5268e9d48e4deb9e5d28be3a2be926ba29949e5a5
3
+ metadata.gz: 42aac288cc2c4d40340ae00490ed8eeb025c17200d31b5ab0fde80a38d780093
4
+ data.tar.gz: fddafe8f31e49a4bd24a6aba943f13425259b4b30dc4af170e2a8b8994652cbe
5
5
  SHA512:
6
- metadata.gz: a63b30cbed53b3b969a539119f83ef6c69327b18ac69c63fe20d6a403aab4676c298940253da5b8d75e6d0bba126ff0846a52678260ee823cd77ae17a3491e8a
7
- data.tar.gz: 87b704e4452c3a678c3907a39152263c8fa85c9bc54c32d61f1dbf9152029fbc40d08d215a691e29d228e55e7aeca3996497df2652c7f10e796f1412cbe70d88
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.4.0)
5
- stack_trace (~> 0.4)
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.4.0)
25
+ stack_trace (0.6.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.4.0"
5
+ VERSION = "0.6.0"
6
6
  end
7
7
  end