tracia 0.2.4 → 0.2.5
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/tracia/default_logger.rb +4 -2
- data/lib/tracia/frame.rb +26 -1
- data/lib/tracia/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1749c13c95b1ecd54e9b6e812bea86021d95960e1d6b07f093a748fc594bc440
|
4
|
+
data.tar.gz: c4bec7a75c6c67e8fc683c475444b902e18bac414730d80a142f8448b1cbe3da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b05410f5cc503504f15daf3fd4dbc833c47677be0032eb9355dd7cd7f4af6ae1d24a292d587afb128ddd6952b17fc2c3012c1adb5ce65efbdd326d911aaa67d
|
7
|
+
data.tar.gz: 4a8492aed4a2e71165e7c7e2bf11ecda59d93cac7fb174175364d6969cfd09add1aa98bcbc6619b78a5fcfac984fb82167081f4df50e2f2b0e8df53157e31b0b
|
@@ -1,11 +1,13 @@
|
|
1
1
|
class Tracia
|
2
2
|
class DefaultLogger
|
3
|
-
def initialize(out: STDOUT)
|
3
|
+
def initialize(out: STDOUT, html: false)
|
4
4
|
@out = out
|
5
|
+
@html = html
|
5
6
|
end
|
6
7
|
|
7
8
|
def call(root)
|
8
|
-
@
|
9
|
+
content = @html ? root.tree_html_full : root.tree_graph
|
10
|
+
@out.puts content
|
9
11
|
end
|
10
12
|
end
|
11
13
|
end
|
data/lib/tracia/frame.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
require "tree_graph"
|
2
|
+
require "tree_html"
|
3
|
+
require "cgi"
|
2
4
|
|
3
5
|
class Tracia
|
4
6
|
class Frame
|
5
7
|
include TreeGraph
|
8
|
+
include TreeHtml
|
6
9
|
|
7
10
|
attr_reader :klass, :call_sym, :method_name, :children, :file, :lineno
|
8
11
|
|
@@ -22,11 +25,33 @@ class Tracia
|
|
22
25
|
end
|
23
26
|
|
24
27
|
def label_for_tree_graph
|
25
|
-
"#{
|
28
|
+
"#{class_and_method} #{source_location}"
|
26
29
|
end
|
27
30
|
|
28
31
|
def children_for_tree_graph
|
29
32
|
children
|
30
33
|
end
|
34
|
+
|
35
|
+
def label_for_tree_html
|
36
|
+
"<span class='hl'>#{CGI::escapeHTML(class_and_method)}</span> #{CGI::escapeHTML(source_location)}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def children_for_tree_html
|
40
|
+
children
|
41
|
+
end
|
42
|
+
|
43
|
+
def css_for_tree_html
|
44
|
+
'.hl{color: #a50000;}'
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def class_and_method
|
50
|
+
"#{klass}#{call_sym}#{method_name}"
|
51
|
+
end
|
52
|
+
|
53
|
+
def source_location
|
54
|
+
"#{GemPaths.shorten(@file)}:#{@lineno}"
|
55
|
+
end
|
31
56
|
end
|
32
57
|
end
|
data/lib/tracia/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tracia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ken
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.2.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tree_html
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.1.8
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.1.8
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: binding_of_callers
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|