trace_tree 0.2.21 → 0.2.22
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 +1 -0
- data/lib/trace_tree.rb +3 -3
- data/lib/trace_tree/tmp_file.rb +4 -1
- data/lib/trace_tree/version.rb +1 -1
- 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: dd1207a48ba8e3bef86a5aca61f42f614a5351f0251107de1eb840752a20c197
|
4
|
+
data.tar.gz: fd0b345cd448977d34255da75e7c8fc8556a305d58a4b3e32d7e6e6014273dcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b2ee0e51cb157b4345616a7b8f68ed8e38bea77d03672b295794017dad8c77591af0e5e7abc3075fc2abb8250a8217c9a4c55371a9ea98b34bed86c24567923
|
7
|
+
data.tar.gz: 8bad826fd1efcb5e33eef42b701845be40bffb54c43196d0e3878f4362509177c6122ce6f28cdaf46373531942e7180813cff7cfe1c7e3d913c76538ca838ca2
|
data/README.md
CHANGED
@@ -59,6 +59,7 @@ end
|
|
59
59
|
* `:warm => nil` by default. Set it something unique to the code block so that the code block will be traced only when it's called second time, in case we dump lots of code loading and initialization.
|
60
60
|
* `:timer => nil` by default. Set it true if you want to know how much time spent in tracing and drawing tree. Notice the `file` should be appendable, otherwise the time will overwrite the tree.
|
61
61
|
* `:debug => nil` by default. Give it `STDOUT`/`STDERR` or anything responds to `:puts` to output a whole list of TracePoints. Or give it a file name in the default tmp dir of your system.
|
62
|
+
* `transcode => false` by default. Set it true to convert unknown character into `"?"` when you see `Encoding::UndefinedConversionError`.
|
62
63
|
|
63
64
|
### Example 1: Output to HTML
|
64
65
|
|
data/lib/trace_tree.rb
CHANGED
@@ -70,12 +70,12 @@ class TraceTree
|
|
70
70
|
loc = opt[:debug]
|
71
71
|
return nil unless loc
|
72
72
|
return loc if loc.respond_to? :puts
|
73
|
-
TmpFile.new loc
|
73
|
+
TmpFile.new loc, transcode: opt[:transcode]
|
74
74
|
end
|
75
75
|
|
76
76
|
def dump_location *log
|
77
|
-
return TmpFile.new
|
78
|
-
return TmpFile.new(opt[:htmp] + '.html') if opt[:htmp]
|
77
|
+
return TmpFile.new(opt[:tmp], transcode: opt[:transcode]) if opt[:tmp]
|
78
|
+
return TmpFile.new((opt[:htmp] + '.html'), transcode: opt[:transcode]) if opt[:htmp]
|
79
79
|
log.empty? ? STDOUT : log[0]
|
80
80
|
end
|
81
81
|
|
data/lib/trace_tree/tmp_file.rb
CHANGED
@@ -12,12 +12,15 @@ class TraceTree
|
|
12
12
|
|
13
13
|
DefaultName = 'trace_tree.html'
|
14
14
|
|
15
|
-
def initialize path
|
15
|
+
def initialize path, transcode: false
|
16
16
|
path = recognize_dir path
|
17
17
|
@tmp = custom path
|
18
|
+
@transcode = transcode
|
18
19
|
end
|
19
20
|
|
20
21
|
def puts *content
|
22
|
+
content = content.map{ |c| c.to_s.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?') } if @transcode
|
23
|
+
|
21
24
|
File.open @tmp, 'a' do |f|
|
22
25
|
f.puts *content
|
23
26
|
end
|
data/lib/trace_tree/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trace_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ken
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|