stack_trace-viz 0.1.0 → 0.3.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: bfa55f7d4332565e082fb0fdf9091156ea0f0927e5c739d0c9733ce45e6ea214
4
+ data.tar.gz: 5a1bbdd5cd0681c489594ad9bc7c4d80fa20c2a30f5f6b6b6959acdd1887f532
5
5
  SHA512:
6
- metadata.gz: 5a8db3cdf8575581afb2b4fd1d0a92f43d324872aca867cf8297f4f3509f5cc72f2b969edc91001c2d891fa2d4523ce041689d0ae2462a7a347d32269f497f4a
7
- data.tar.gz: 459c5f427d111bbf799b0a982b2e0c1f95769c70dd9e403c3047e1c3b4f662ccd7c2b33288e65dc2ee2e49fd2db329949d065ebe0c330083ca1862c4da269046
6
+ metadata.gz: cb9c137e44a346f067d2b444391d727cc064d18cddb6e0d6793fcdba84bc7e1c6f8230da0386a678300ff1721b847838d9c4daca2b0feb98f4abc2b82a079e06
7
+ data.tar.gz: 2517defbfd270f8a8113768f9779d476989a36f20ae1f3f39309ede79e9743bd226f282fac666b2a70dde4cc8b0cedc19959cdabe5f6295fdb2299d5f1249baa
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stack_trace-viz (0.1.0)
5
- stack_trace (~> 0.3)
4
+ stack_trace-viz (0.3.0)
5
+ stack_trace (~> 0.4)
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.3.0)
25
+ stack_trace (0.4.0)
26
26
 
27
27
  PLATFORMS
28
28
  arm64-darwin-21
@@ -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.3.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
@@ -24,5 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_dependency "stack_trace", "~> 0.3"
27
+ spec.add_dependency "stack_trace", "~> 0.4"
28
28
  end
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.3.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
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.3'
19
+ version: '0.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.3'
26
+ version: '0.4'
27
27
  description:
28
28
  email:
29
29
  - mehmetemininac@gmail.com