stack_trace-viz 0.1.0 → 0.2.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: dcace0deb24bfe4ee38c471a14f0af16ae7fadabab3de7c0dc8d452d2e7dacf8
4
- data.tar.gz: 7d8c5a8bf915b1f979da97b6ef5859fbc705970f91a49cf334dd528f9ff75785
3
+ metadata.gz: 03df308cf1ce77b8db23a292b58ef5864911f67a8e0fdeedfd8102877b246c3a
4
+ data.tar.gz: b75d9416b8fab39ce8029dfaae876cd86eb8cbb995286191b284c050132bac70
5
5
  SHA512:
6
- metadata.gz: 5a8db3cdf8575581afb2b4fd1d0a92f43d324872aca867cf8297f4f3509f5cc72f2b969edc91001c2d891fa2d4523ce041689d0ae2462a7a347d32269f497f4a
7
- data.tar.gz: 459c5f427d111bbf799b0a982b2e0c1f95769c70dd9e403c3047e1c3b4f662ccd7c2b33288e65dc2ee2e49fd2db329949d065ebe0c330083ca1862c4da269046
6
+ metadata.gz: 18044b403e3121a166e79821ff0e784e0b6ab03ee5a358c13f6cdee7e6e4dbcc948e2fc1c2a63f712fa67aed60ecf3ed71d57688c7ddc8b6c9afea5ee08dfc1d
7
+ data.tar.gz: 3f6cc6632f536919d94b16140f3429388cbe794f84a43a9c4375ba4e26d2e06dcdd9b32e19be6b5d1d7012ba224e1aad8a4ade795b79e8ecf6aaf4eb27d4a75a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stack_trace-viz (0.1.0)
4
+ stack_trace-viz (0.2.0)
5
5
  stack_trace (~> 0.3)
6
6
 
7
7
  GEM
@@ -9,31 +9,36 @@ module StackTrace
9
9
  class HTML
10
10
  LAYOUT_FILE = "../../public/main.html.erb"
11
11
 
12
- def initialize(trace, **extra)
13
- @trace = trace
14
- @extra = extra
12
+ def initialize
13
+ @traces = []
15
14
  end
16
15
 
17
16
  def save(file_path)
18
17
  file_path ||= default_file_path
19
18
 
20
19
  File.open(file_path, "w") { |f| f.write(content) }
20
+
21
+ file_path
22
+ end
23
+
24
+ def add(trace, **extra)
25
+ traces << {
26
+ description: "Generated by StackTrace::Viz",
27
+ **extra,
28
+ trace: trace
29
+ }
21
30
  end
22
31
 
23
32
  private
24
33
 
25
- attr_reader :trace, :extra
34
+ attr_reader :traces
26
35
 
27
36
  def content
28
37
  erb.result_with_hash({ trace_data: trace_data })
29
38
  end
30
39
 
31
40
  def trace_data
32
- JSON.generate({
33
- description: "Generated by StackTrace::Viz",
34
- **extra,
35
- trace: trace
36
- })
41
+ JSON.generate(traces)
37
42
  end
38
43
 
39
44
  def erb
@@ -2,6 +2,6 @@
2
2
 
3
3
  module StackTrace
4
4
  module Viz
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
@@ -12,8 +12,10 @@ module StackTrace
12
12
  LAYOUT_FILE = "../public/main.html.erb"
13
13
 
14
14
  class << self
15
- def save_current!(file_path = nil, **extra)
16
- HTML.new(StackTrace.current, **extra).save(file_path)
15
+ def save_current!(file_path: nil, **extra)
16
+ html = HTML.new
17
+ html.add(StackTrace.current, **extra)
18
+ html.save(file_path)
17
19
  end
18
20
 
19
21
  def as_json
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stack_trace-viz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehmet Emin INAC
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-05 00:00:00.000000000 Z
11
+ date: 2023-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stack_trace