debugvisualizer 0.1.2 → 0.1.4
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/lib/debugvisualizer/rexml.rb +55 -0
- data/lib/debugvisualizer/version.rb +1 -1
- data/lib/debugvisualizer.rb +7 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99b5095a86aff837ff3210a772f31625ec184c6393076a86df47137f10a8da38
|
4
|
+
data.tar.gz: e7eda2e94c63f0428960bbd1185e347152c356da410ad9646327983255283797
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28059f5e1c89d4642e99e0672ed18d677b4b87430cf8f33ebdb23ebfef09462f054fd865d1bf6b02bfb4915f826a7706482c2bddda50b616cd6ad7f14eec3899
|
7
|
+
data.tar.gz: bf6103a0494df88e7ba175402efae691f6ab285b7efa936c05907100af1db59141578a7094cc9ab4d8b655223913854aae4dfb85779b870f32f77804fca735e3
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module DebugVisualizer
|
2
|
+
DebugVisualizer.register do |data|
|
3
|
+
if defined?(REXML::Document) && data.kind_of?(REXML::Document)
|
4
|
+
{
|
5
|
+
id: "rexml_visualizer",
|
6
|
+
name: "REXML As Tree",
|
7
|
+
data: {
|
8
|
+
kind: { tree: true },
|
9
|
+
root: get_tree(data)[0]
|
10
|
+
}
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.get_tree(elems)
|
16
|
+
result = []
|
17
|
+
elems.each_element{|elem|
|
18
|
+
child = []
|
19
|
+
elem.attributes.each_attribute{|atr|
|
20
|
+
items = []
|
21
|
+
items << {
|
22
|
+
text: "#{atr.name}: ",
|
23
|
+
emphasis: 'style2'
|
24
|
+
}
|
25
|
+
items << {
|
26
|
+
text: atr.value,
|
27
|
+
emphasis: 'style2'
|
28
|
+
}
|
29
|
+
child << {
|
30
|
+
items: items,
|
31
|
+
children: []
|
32
|
+
}
|
33
|
+
}
|
34
|
+
if elem.has_elements?
|
35
|
+
child.push *get_tree(elem)
|
36
|
+
end
|
37
|
+
tree = {
|
38
|
+
items: [
|
39
|
+
{
|
40
|
+
text: elem.name,
|
41
|
+
emphasis: 'style1'
|
42
|
+
}
|
43
|
+
],
|
44
|
+
children: child
|
45
|
+
}
|
46
|
+
if elem.text && elem.text.strip != ""
|
47
|
+
tree[:items] << {
|
48
|
+
text: ' ' * 2 + elem.text.strip
|
49
|
+
}
|
50
|
+
end
|
51
|
+
result << tree
|
52
|
+
}
|
53
|
+
result
|
54
|
+
end
|
55
|
+
end
|
data/lib/debugvisualizer.rb
CHANGED
@@ -19,7 +19,12 @@ module DebugVisualizer
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def to_debug_visualizer_protocol_json preferred_id, data
|
22
|
-
GENERATOR.generate preferred_id, data
|
22
|
+
json = GENERATOR.generate preferred_id, data
|
23
|
+
if defined? ::DEBUGGER__::NaiveString
|
24
|
+
::DEBUGGER__::NaiveString.new(json)
|
25
|
+
else
|
26
|
+
json
|
27
|
+
end
|
23
28
|
end
|
24
29
|
|
25
30
|
module_function :register, :to_debug_visualizer_protocol_json
|
@@ -110,3 +115,4 @@ require_relative 'debugvisualizer/array'
|
|
110
115
|
require_relative 'debugvisualizer/hash'
|
111
116
|
require_relative 'debugvisualizer/to_string'
|
112
117
|
require_relative 'debugvisualizer/string_diff'
|
118
|
+
require_relative 'debugvisualizer/rexml'
|
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.4
|
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
|
+
date: 2022-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: debugvisualizer generates JSON based on VS Code Debug Visualizer protocol
|
14
14
|
email:
|
@@ -26,6 +26,7 @@ files:
|
|
26
26
|
- lib/debugvisualizer/active_record.rb
|
27
27
|
- lib/debugvisualizer/array.rb
|
28
28
|
- lib/debugvisualizer/hash.rb
|
29
|
+
- lib/debugvisualizer/rexml.rb
|
29
30
|
- lib/debugvisualizer/string_diff.rb
|
30
31
|
- lib/debugvisualizer/to_string.rb
|
31
32
|
- lib/debugvisualizer/version.rb
|