debugtrace 1.3.0 → 1.3.1
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/CHANGELOG.md +4 -0
- data/CHANGELOG_ja.md +4 -0
- data/README.md +27 -27
- data/README_ja.md +27 -27
- data/lib/debugtrace/version.rb +1 -1
- data/lib/debugtrace.rb +10 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 532ea3832059c93712bc0b142ac493de5ae5ab71c7f312a46be3a6f0a251c8a0
|
4
|
+
data.tar.gz: 970f31cbf67a4f3f4d2f316d4ab3cad0fbe8646d5aa8accd7540d8bce3e0ae2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a70f4ce98f48793d6a88b8ebe6140ceecf53c70aa66f41c3f850159d69e447d28d328d4bc1a2108ca4a13d64400741948fb3ab152953fcfecd2828440510176
|
7
|
+
data.tar.gz: 94cee6b4120f217fc3be0bfbf0670388da26a5c3e11e709fa5b3215914b48cae0853a6bd421ec692f0fa8db28781a89dd648c22280c793ffc4f920899c1a7a9e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 1.3.1 - July 15, 2025
|
2
|
+
* Even if `string_as_bytes: true` is specified in the `print` method, if the string encoding is not `ASCII_8BIT`, it will be output as a normal string.
|
3
|
+
* If an exception is thrown when trying to output as a normal string, it will be output in hexadecimal.
|
4
|
+
|
1
5
|
## 1.3.0 - July 12, 2025
|
2
6
|
|
3
7
|
* Added optional argument `string_as_bytes` (default: `false`) to the `print` method. The string will be output in hexadecimal if it is `true`.
|
data/CHANGELOG_ja.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 1.3.1 - 2025/7/15
|
2
|
+
* `print`メソッドで`string_as_bytes: true`が指定されていても文字列のエンコードが`ASCII_8BIT`ではない場合は、通常の文字列として出力するようにしました。
|
3
|
+
* 通常の文字列として出力しようとして例外がスローされた場合は、16進数で出力するようにしました。
|
4
|
+
|
1
5
|
## 1.3.0 - 2025/7/12
|
2
6
|
|
3
7
|
* `print`メソッドにオプション引数`string_as_bytes`(デフォルト: `false`)を追加しました。`true`を指定した場合は、文字列を16進数で出力します。
|
data/README.md
CHANGED
@@ -77,32 +77,32 @@ func1
|
|
77
77
|
```
|
78
78
|
|
79
79
|
```log
|
80
|
-
2025-07-
|
81
|
-
2025-07-
|
82
|
-
2025-07-
|
83
|
-
2025-07-
|
84
|
-
2025-07-
|
85
|
-
2025-07-
|
86
|
-
2025-07-
|
87
|
-
2025-07-
|
88
|
-
2025-07-
|
89
|
-
2025-07-
|
90
|
-
2025-07-
|
91
|
-
2025-07-
|
92
|
-
2025-07-
|
93
|
-
2025-07-
|
94
|
-
2025-07-
|
95
|
-
2025-07-
|
96
|
-
2025-07-
|
97
|
-
2025-07-
|
98
|
-
2025-07-
|
99
|
-
2025-07-
|
100
|
-
2025-07-
|
101
|
-
2025-07-
|
102
|
-
2025-07-
|
103
|
-
2025-07-
|
104
|
-
2025-07-
|
105
|
-
2025-07-
|
80
|
+
2025-07-15 20:45:14.106+09:00 DebugTrace-rb 1.3.1 on Ruby 3.4.4
|
81
|
+
2025-07-15 20:45:14.106+09:00 config file: ./debugtrace.yml
|
82
|
+
2025-07-15 20:45:14.106+09:00 logger: StdErrLogger
|
83
|
+
2025-07-15 20:45:14.106+09:00
|
84
|
+
2025-07-15 20:45:14.106+09:00 ______________________________ #72 ______________________________
|
85
|
+
2025-07-15 20:45:14.106+09:00
|
86
|
+
2025-07-15 20:45:14.106+09:00 Enter func1 (examples/readme-example.rb:29) <- <main> (examples/readme-example.rb:35)
|
87
|
+
2025-07-15 20:45:14.106+09:00 | Hello, World! (examples/readme-example.rb:30)
|
88
|
+
2025-07-15 20:45:14.106+09:00 | Enter func2 (examples/readme-example.rb:20) <- func1 (examples/readme-example.rb:31)
|
89
|
+
2025-07-15 20:45:14.106+09:00 | | Enter Contact#initialize (examples/readme-example.rb:10) <- Class#new (examples/readme-example.rb:22)
|
90
|
+
2025-07-15 20:45:14.106+09:00 | | Leave Contact#initialize (examples/readme-example.rb:15) duration: 0.011 ms
|
91
|
+
2025-07-15 20:45:14.106+09:00 | |
|
92
|
+
2025-07-15 20:45:14.106+09:00 | | Enter Contact#initialize (examples/readme-example.rb:10) <- Class#new (examples/readme-example.rb:23)
|
93
|
+
2025-07-15 20:45:14.106+09:00 | | Leave Contact#initialize (examples/readme-example.rb:15) duration: 0.019 ms
|
94
|
+
2025-07-15 20:45:14.106+09:00 | Leave func2 (examples/readme-example.rb:25) duration: 0.229 ms
|
95
|
+
2025-07-15 20:45:14.106+09:00 Leave func1 (examples/readme-example.rb:32) duration: 0.361 ms
|
96
|
+
2025-07-15 20:45:14.107+09:00
|
97
|
+
2025-07-15 20:45:14.107+09:00 contacts = [
|
98
|
+
2025-07-15 20:45:14.107+09:00 Contact{
|
99
|
+
2025-07-15 20:45:14.107+09:00 @id: 1, @firstName: 'Akane', @lastName: 'Apple', @birthday: 1991-02-03
|
100
|
+
2025-07-15 20:45:14.107+09:00 },
|
101
|
+
2025-07-15 20:45:14.107+09:00 Contact{
|
102
|
+
2025-07-15 20:45:14.107+09:00 @id: 2, @firstName: 'Yukari', @lastName: 'Apple',
|
103
|
+
2025-07-15 20:45:14.107+09:00 @birthday: 1992-03-04
|
104
|
+
2025-07-15 20:45:14.107+09:00 }
|
105
|
+
2025-07-15 20:45:14.107+09:00 ] (examples/readme-example.rb:36)
|
106
106
|
```
|
107
107
|
|
108
108
|
### 4. List of methods
|
@@ -136,7 +136,7 @@ DebugTrace module has the following methods.
|
|
136
136
|
<p><code>value</code>: the value <small>(Optional)</small></p>
|
137
137
|
<small><i>The following arguments are keyword arguments and optional</i></small></p>
|
138
138
|
<p><code>reflection</code>: reflection is used aggressively if <code>true</code>, used passively if <code>false</code> (Default: <code>false</code>)</p>
|
139
|
-
<p><code>string_as_bytes</code>: Output strings in hexadecimal if <code>true</code> <small>(Default: <code>false</code>)</small></p>
|
139
|
+
<p><code>string_as_bytes</code>: Output strings which encoding is <code>ASCII_8BIT</code> in hexadecimal if <code>true</code> <small>(Default: <code>false</code>)</small></p>
|
140
140
|
<small><i>The following arguments can be specified in debugtrace.yml (argument specification takes precedence)</i></small></p>
|
141
141
|
<p><code>minimum_output_size</code>: The minimum number of elements to print for <code>Array</code>, <code>Hash</code> and <code>Set</code></p>
|
142
142
|
<p><code>minimum_output_length</code>: The minimum length to print the length of the string<br>
|
data/README_ja.md
CHANGED
@@ -77,32 +77,32 @@ DebugTrace.print('contacts', contacts)
|
|
77
77
|
```
|
78
78
|
|
79
79
|
```log
|
80
|
-
2025-07-
|
81
|
-
2025-07-
|
82
|
-
2025-07-
|
83
|
-
2025-07-
|
84
|
-
2025-07-
|
85
|
-
2025-07-
|
86
|
-
2025-07-
|
87
|
-
2025-07-
|
88
|
-
2025-07-
|
89
|
-
2025-07-
|
90
|
-
2025-07-
|
91
|
-
2025-07-
|
92
|
-
2025-07-
|
93
|
-
2025-07-
|
94
|
-
2025-07-
|
95
|
-
2025-07-
|
96
|
-
2025-07-
|
97
|
-
2025-07-
|
98
|
-
2025-07-
|
99
|
-
2025-07-
|
100
|
-
2025-07-
|
101
|
-
2025-07-
|
102
|
-
2025-07-
|
103
|
-
2025-07-
|
104
|
-
2025-07-
|
105
|
-
2025-07-
|
80
|
+
2025-07-15 20:45:14.106+09:00 DebugTrace-rb 1.3.1 on Ruby 3.4.4
|
81
|
+
2025-07-15 20:45:14.106+09:00 config file: ./debugtrace.yml
|
82
|
+
2025-07-15 20:45:14.106+09:00 logger: StdErrLogger
|
83
|
+
2025-07-15 20:45:14.106+09:00
|
84
|
+
2025-07-15 20:45:14.106+09:00 ______________________________ #72 ______________________________
|
85
|
+
2025-07-15 20:45:14.106+09:00
|
86
|
+
2025-07-15 20:45:14.106+09:00 Enter func1 (examples/readme-example.rb:29) <- <main> (examples/readme-example.rb:35)
|
87
|
+
2025-07-15 20:45:14.106+09:00 | Hello, World! (examples/readme-example.rb:30)
|
88
|
+
2025-07-15 20:45:14.106+09:00 | Enter func2 (examples/readme-example.rb:20) <- func1 (examples/readme-example.rb:31)
|
89
|
+
2025-07-15 20:45:14.106+09:00 | | Enter Contact#initialize (examples/readme-example.rb:10) <- Class#new (examples/readme-example.rb:22)
|
90
|
+
2025-07-15 20:45:14.106+09:00 | | Leave Contact#initialize (examples/readme-example.rb:15) duration: 0.011 ms
|
91
|
+
2025-07-15 20:45:14.106+09:00 | |
|
92
|
+
2025-07-15 20:45:14.106+09:00 | | Enter Contact#initialize (examples/readme-example.rb:10) <- Class#new (examples/readme-example.rb:23)
|
93
|
+
2025-07-15 20:45:14.106+09:00 | | Leave Contact#initialize (examples/readme-example.rb:15) duration: 0.019 ms
|
94
|
+
2025-07-15 20:45:14.106+09:00 | Leave func2 (examples/readme-example.rb:25) duration: 0.229 ms
|
95
|
+
2025-07-15 20:45:14.106+09:00 Leave func1 (examples/readme-example.rb:32) duration: 0.361 ms
|
96
|
+
2025-07-15 20:45:14.107+09:00
|
97
|
+
2025-07-15 20:45:14.107+09:00 contacts = [
|
98
|
+
2025-07-15 20:45:14.107+09:00 Contact{
|
99
|
+
2025-07-15 20:45:14.107+09:00 @id: 1, @firstName: 'Akane', @lastName: 'Apple', @birthday: 1991-02-03
|
100
|
+
2025-07-15 20:45:14.107+09:00 },
|
101
|
+
2025-07-15 20:45:14.107+09:00 Contact{
|
102
|
+
2025-07-15 20:45:14.107+09:00 @id: 2, @firstName: 'Yukari', @lastName: 'Apple',
|
103
|
+
2025-07-15 20:45:14.107+09:00 @birthday: 1992-03-04
|
104
|
+
2025-07-15 20:45:14.107+09:00 }
|
105
|
+
2025-07-15 20:45:14.107+09:00 ] (examples/readme-example.rb:36)
|
106
106
|
```
|
107
107
|
|
108
108
|
### 4. メソッド一覧
|
@@ -136,7 +136,7 @@ DebugTraceモジュールには以下のメソッドがあります。
|
|
136
136
|
<p><code>value</code>: 値 <small>(省略可)</small></p>
|
137
137
|
<small><i>以降の引数は、キーワード引数で省略可</i></small>
|
138
138
|
<code>reflection</code>: <code>true</code>ならリフレクションを積極的に使用、<code>false</code>なら消極的に使用 <small>(デフォルト: <code>false</code>)</small></p>
|
139
|
-
<p><code>string_as_bytes</code>: <code>true</code
|
139
|
+
<p><code>string_as_bytes</code>: <code>true</code>ならエンコードが<code>ASCII_8BIT</code>の文字列を16進数で出力する<small>(デフォルト: <code>false</code>)</small></p>
|
140
140
|
<small><i>以降の引数は、debugtrace.ymlで指定可能 (引数指定が優先)</i></small><br>
|
141
141
|
<p><code>minimum_output_size</code>: <code>Array</code>, <code>Hash</code>および<code>Set</code>の要素数を出力する最小要素数</p>
|
142
142
|
<p><code>minimum_output_length</code>: 文字列の長さを出力する最小の長さ<br>
|
data/lib/debugtrace/version.rb
CHANGED
data/lib/debugtrace.rb
CHANGED
@@ -168,8 +168,16 @@ module DebugTrace
|
|
168
168
|
when Module
|
169
169
|
buff.append(value.name).no_break_append(' module')
|
170
170
|
when String
|
171
|
-
value_buff =
|
172
|
-
|
171
|
+
value_buff = nil
|
172
|
+
if print_options.string_as_bytes && value.encoding == Encoding::ASCII_8BIT
|
173
|
+
value_buff = to_string_bytes(value, print_options)
|
174
|
+
else
|
175
|
+
begin
|
176
|
+
value_buff = to_string_str(value, print_options)
|
177
|
+
rescue
|
178
|
+
value_buff = to_string_bytes(value, print_options)
|
179
|
+
end
|
180
|
+
end
|
173
181
|
buff.append_buffer(value_buff)
|
174
182
|
when DateTime, Time
|
175
183
|
buff.append(value.strftime('%Y-%m-%d %H:%M:%S.%L%:z'))
|