debugvisualizer 0.1.0 → 0.1.2
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 +4 -4
- data/README.md +4 -0
- data/debugvisualizer.gemspec +2 -0
- data/lib/debugvisualizer/version.rb +1 -1
- data/lib/debugvisualizer.rb +21 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b719636b47462d2a54b48ff79f1ede7f301e3dd9e46eace72082229c04456c3
|
4
|
+
data.tar.gz: 237313e0d0370b4f6ae84f863d942fe302880fc99c2ba0aedcf987cce81cf096
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8137405f3127b4aa8c4bd2ae65f63983a064fb33b12daaaf6460058aaa89307692c6ce217f1bc8dd6883934ee93f5326b66145dfe186f848e5d285b352605c4d
|
7
|
+
data.tar.gz: 0db17a85c88c001d4ed17c2dc15ac044f9647b11c54d2d3b3d69949882c1a8ed6812251b2edb92e09a2123c8bafb2b6c0830580d5fab978a4ace8b9b540056a1
|
data/README.md
CHANGED
@@ -40,3 +40,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
40
40
|
## Contributing
|
41
41
|
|
42
42
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/debugvisualizer.
|
43
|
+
|
44
|
+
## Acknowledgement
|
45
|
+
|
46
|
+
[Koichi Sasada (@ko1)](https://github.com/ko1) - He reviewed API and gave me many ideas to improve `debugvisualizer`.
|
data/debugvisualizer.gemspec
CHANGED
data/lib/debugvisualizer.rb
CHANGED
@@ -4,13 +4,18 @@ require 'securerandom'
|
|
4
4
|
require 'json'
|
5
5
|
|
6
6
|
module DebugVisualizer
|
7
|
-
def register &block
|
7
|
+
def register klass = nil, &block
|
8
8
|
raise unless block_given?
|
9
9
|
|
10
10
|
unless defined? GENERATOR
|
11
11
|
DebugVisualizer.const_set(:GENERATOR, JSONGenerator.new)
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
|
+
if klass
|
15
|
+
GENERATOR.register_block_with_class klass, block
|
16
|
+
else
|
17
|
+
GENERATOR.register_block block
|
18
|
+
end
|
14
19
|
end
|
15
20
|
|
16
21
|
def to_debug_visualizer_protocol_json preferred_id, data
|
@@ -24,12 +29,17 @@ module DebugVisualizer
|
|
24
29
|
|
25
30
|
def initialize
|
26
31
|
@blocks = []
|
32
|
+
@block_with_class = {}
|
27
33
|
end
|
28
34
|
|
29
35
|
def register_block block
|
30
36
|
@blocks << block
|
31
37
|
end
|
32
38
|
|
39
|
+
def register_block_with_class klass, block
|
40
|
+
@block_with_class[klass] = block
|
41
|
+
end
|
42
|
+
|
33
43
|
def generate preferred_id, data
|
34
44
|
extractors = []
|
35
45
|
@blocks.each{|block|
|
@@ -39,6 +49,15 @@ module DebugVisualizer
|
|
39
49
|
end
|
40
50
|
}
|
41
51
|
|
52
|
+
@block_with_class.each{|klass, block|
|
53
|
+
if data.kind_of? klass
|
54
|
+
result = block.call(data)
|
55
|
+
if result && result[:id] && result[:data]
|
56
|
+
extractors << get_extractor(result)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
}
|
60
|
+
|
42
61
|
return JSON.generate({ kind: "NoExtractors" }) if extractors.empty?
|
43
62
|
|
44
63
|
sorted = extractors.sort_by{|ex| -ex[:priority]}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: debugvisualizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naoto Ono
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: debugvisualizer generates JSON based on VS Code Debug Visualizer protocol
|
14
14
|
email:
|