debugtrace 1.1.1 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 329e4c78cb0dd2a7778ec83d17c6b8b6a98bddcb27360322fa757d9c0779fd04
4
- data.tar.gz: f1b7c56f4c029320a869c71e84babbf521f1b43dae89be907bca1a8e00f0dda5
3
+ metadata.gz: d0fd5212be7e014267a9795f6de78a3cc53f3c04d9f7214cddc798c36be0e746
4
+ data.tar.gz: d21287e1f2d00d7fb65b3b486aa7a7c4a115c9f795b5efad4f3b74a6b69fa1fb
5
5
  SHA512:
6
- metadata.gz: 72de200654893939ec841d1c70ba56be2f028b2afed076fbc649ccdc07b67a8a71705719e97e7bd5d3379143c43be6f4ec00c6c3f9e5308dec6132ff5a963957
7
- data.tar.gz: 1159e8da5fc15885699615004d0ef361317f748281c7e90b284119adf64dcc6835578959cae095aed2640997ddb4be226437ca2049e5041c0911e2096dc5e970
6
+ metadata.gz: 6b737dacef0b6a82c8acd25cd6117432313e931d2181f8c1be1557534e9e97e311dec5ecbd10eedd85da914dacb27805abf660f0e790ba7dad1c7dfa7c58260a
7
+ data.tar.gz: 64e246128f381dd3e8058d524b3878e0017f9db4d99b42deed5fb8c9aeb06d3a4216a51bc7360e5e51be3fdc9bfb58317e86e8ae639359562f45d6de63a9e30f
data/CHANGELOG.md CHANGED
@@ -1,11 +1,14 @@
1
+ ## 1.1.2 - July 2, 2025
2
+
3
+ Fixed a bug that caused exceptions to be thrown by the `print` methods depending on the conditions.
4
+
1
5
  ## 1.1.1 - July 1, 2025
2
6
 
3
- ### Bug fixes
4
- * Fixed a bug that caused exceptions to be thrown by the `enter`, `leave` and `print` methods depending on the conditions.
7
+ Fixed a bug that caused exceptions to be thrown by the `enter`, `leave` and `print` methods depending on the conditions.
5
8
 
6
9
  ## 1.1.0 - May 25, 2025
7
10
 
8
- ### Bug fixes
11
+ ### Bug fix
9
12
 
10
13
  * Fixed a bug where line breaks were not inserted between elements when outputting `Array`, `Hash`, and `Set` using the print method.
11
14
 
data/CHANGELOG_ja.md CHANGED
@@ -1,13 +1,14 @@
1
+ ## 1.1.2 - 2025/7/2
2
+
3
+ 条件によって`print`メソッドで例外がスローされるバグを修正。
4
+
1
5
  ## 1.1.1 - 2025/7/1
2
6
 
3
- #### バグ修正
4
- * 条件によって`enter`, `leave`, `print`メソッドで例外がスローされるバグを修正。
7
+ 条件によって`enter`, `leave`, `print`メソッドで例外がスローされるバグを修正。
5
8
 
6
9
  ## 1.1.0 - 2025/5/25
7
10
 
8
- #### バグ修正
9
-
10
- * `print`メソッドで`Array`, `Hash`および`Set`を出力する場合に要素間での改行が行われないバグの修正。
11
+ `print`メソッドで`Array`, `Hash`および`Set`を出力する場合に要素間での改行が行われないバグの修正。
11
12
 
12
13
  #### 仕様変更
13
14
 
@@ -17,7 +18,7 @@
17
18
 
18
19
  ## 1.0.1 - 2025/5/19
19
20
 
20
- 環境変数 `DEBUGTRACE_CONFIG` が設定されていない場合にエラーが発生するバグを修正
21
+ 環境変数 `DEBUGTRACE_CONFIG` が設定されていない場合にエラーが発生するバグを修正。
21
22
 
22
23
  ## 1.0.0 - 2025/5/18
23
24
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DebugTrace
4
- VERSION = '1.1.1'
4
+ VERSION = '1.1.2'
5
5
  end
data/lib/debugtrace.rb CHANGED
@@ -181,25 +181,29 @@ module DebugTrace
181
181
  buff.append_buffer(value_buff)
182
182
  else
183
183
  reflection = print_options.reflection || value.class.superclass == Struct
184
-
185
- to_s_string = reflection ? '' : value.to_s
186
- if reflection || to_s_string.start_with?('#<')
187
- # use reflection
188
- value_buff = LogBuffer.new(@@config.data_output_width)
189
- if @@reflected_objects.any? { |obj| value.equal?(obj) }
190
- # cyclic reference
191
- value_buff.no_break_append(@@config.circular_reference_string)
192
- elsif @@reflected_objects.length > print_options.reflection_limit
193
- # over reflection level limitation
194
- value_buff.no_break_append(@@config.limit_string)
184
+
185
+ begin
186
+ to_s_string = reflection ? '' : value.to_s
187
+ if reflection || to_s_string.start_with?('#<')
188
+ # use reflection
189
+ value_buff = LogBuffer.new(@@config.data_output_width)
190
+ if @@reflected_objects.any? { |obj| value.equal?(obj) }
191
+ # cyclic reference
192
+ value_buff.no_break_append(@@config.circular_reference_string)
193
+ elsif @@reflected_objects.length > print_options.reflection_limit
194
+ # over reflection level limitation
195
+ value_buff.no_break_append(@@config.limit_string)
196
+ else
197
+ @@reflected_objects.push(value)
198
+ value_buff = to_string_reflection(value, print_options)
199
+ @@reflected_objects.pop
200
+ end
201
+ buff.append_buffer(value_buff)
195
202
  else
196
- @@reflected_objects.push(value)
197
- value_buff = to_string_reflection(value, print_options)
198
- @@reflected_objects.pop
203
+ buff.append(to_s_string)
199
204
  end
200
- buff.append_buffer(value_buff)
201
- else
202
- buff.append(to_s_string)
205
+ rescue => e
206
+ buff.append("Raised #{e.class.to_s}: '#{e.message}'")
203
207
  end
204
208
  end
205
209
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debugtrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masato Kokubo