debugtrace 1.3.1 → 1.3.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: 532ea3832059c93712bc0b142ac493de5ae5ab71c7f312a46be3a6f0a251c8a0
4
- data.tar.gz: 970f31cbf67a4f3f4d2f316d4ab3cad0fbe8646d5aa8accd7540d8bce3e0ae2c
3
+ metadata.gz: f351de13b8fc8844e234a3725e9af20f9dcba4ecbcf73490a24ebbdeb698eb7f
4
+ data.tar.gz: 305ee479e282fa2ade876ef77e6208b5f01d2e71746a8107847901d052c43a77
5
5
  SHA512:
6
- metadata.gz: 3a70f4ce98f48793d6a88b8ebe6140ceecf53c70aa66f41c3f850159d69e447d28d328d4bc1a2108ca4a13d64400741948fb3ab152953fcfecd2828440510176
7
- data.tar.gz: 94cee6b4120f217fc3be0bfbf0670388da26a5c3e11e709fa5b3215914b48cae0853a6bd421ec692f0fa8db28781a89dd648c22280c793ffc4f920899c1a7a9e
6
+ metadata.gz: 22936ed6dcd7efd2933b83ed5b3d4081a0aa934c314dae86878933bcb86230d1c5be77921a5cce1ebc941a9696845534552f570e148a4ad1e185b4f6461eb62e
7
+ data.tar.gz: 69f25a8bf99c9e788192cb9c743ab55a2ac984ca1f67f6ab3da9164b8186eb48650ceda79bd939d9cb274082f4bd64911f323644648ec782f8765247361b94e0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.3.2 - September 19, 2025
2
+ * When running from RubyMine, the source file path is now output as a relative path from the current directory, rather than as an absolute path.
3
+
1
4
  ## 1.3.1 - July 15, 2025
2
5
  * 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
6
  * If an exception is thrown when trying to output as a normal string, it will be output in hexadecimal.
data/CHANGELOG_ja.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.3.2 - 2025/9/19
2
+ * RubyMineから実行した場合に、ソースファイルが絶対パスで出力されるのをカレントディレクトリからの相対パスに変更しました。
3
+
1
4
  ## 1.3.1 - 2025/7/15
2
5
  * `print`メソッドで`string_as_bytes: true`が指定されていても文字列のエンコードが`ASCII_8BIT`ではない場合は、通常の文字列として出力するようにしました。
3
6
  * 通常の文字列として出力しようとして例外がスローされた場合は、16進数で出力するようにしました。
data/README.md CHANGED
@@ -77,32 +77,32 @@ func1
77
77
  ```
78
78
 
79
79
  ```log
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)
80
+ 2025-09-23 09:40:54.733+09:00 DebugTrace-rb 1.3.2 on Ruby 3.4.6 / x86_64-linux
81
+ 2025-09-23 09:40:54.733+09:00 config file: ./debugtrace.yml
82
+ 2025-09-23 09:40:54.733+09:00 logger: StdErrLogger
83
+ 2025-09-23 09:40:54.733+09:00
84
+ 2025-09-23 09:40:54.733+09:00 ______________________________ #72 ______________________________
85
+ 2025-09-23 09:40:54.733+09:00
86
+ 2025-09-23 09:40:54.733+09:00 Enter func1 (examples/readme-example.rb:29) <- <main> (examples/readme-example.rb:35)
87
+ 2025-09-23 09:40:54.733+09:00 | Hello, World! (examples/readme-example.rb:30)
88
+ 2025-09-23 09:40:54.733+09:00 | Enter func2 (examples/readme-example.rb:20) <- func1 (examples/readme-example.rb:31)
89
+ 2025-09-23 09:40:54.734+09:00 | | Enter Contact#initialize (examples/readme-example.rb:10) <- Class#new (examples/readme-example.rb:22)
90
+ 2025-09-23 09:40:54.734+09:00 | | Leave Contact#initialize (examples/readme-example.rb:15) duration: 0.014 ms
91
+ 2025-09-23 09:40:54.734+09:00 | |
92
+ 2025-09-23 09:40:54.734+09:00 | | Enter Contact#initialize (examples/readme-example.rb:10) <- Class#new (examples/readme-example.rb:23)
93
+ 2025-09-23 09:40:54.734+09:00 | | Leave Contact#initialize (examples/readme-example.rb:15) duration: 0.007 ms
94
+ 2025-09-23 09:40:54.734+09:00 | Leave func2 (examples/readme-example.rb:25) duration: 0.206 ms
95
+ 2025-09-23 09:40:54.734+09:00 Leave func1 (examples/readme-example.rb:32) duration: 0.332 ms
96
+ 2025-09-23 09:40:54.734+09:00
97
+ 2025-09-23 09:40:54.734+09:00 contacts = [
98
+ 2025-09-23 09:40:54.734+09:00 Contact{
99
+ 2025-09-23 09:40:54.734+09:00 @id: 1, @firstName: 'Akane', @lastName: 'Apple', @birthday: 1991-02-03
100
+ 2025-09-23 09:40:54.734+09:00 },
101
+ 2025-09-23 09:40:54.734+09:00 Contact{
102
+ 2025-09-23 09:40:54.734+09:00 @id: 2, @firstName: 'Yukari', @lastName: 'Apple',
103
+ 2025-09-23 09:40:54.734+09:00 @birthday: 1992-03-04
104
+ 2025-09-23 09:40:54.734+09:00 }
105
+ 2025-09-23 09:40:54.734+09:00 ] (examples/readme-example.rb:36)
106
106
  ```
107
107
 
108
108
  ### 4. List of methods
data/README_ja.md CHANGED
@@ -77,32 +77,32 @@ DebugTrace.print('contacts', contacts)
77
77
  ```
78
78
 
79
79
  ```log
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)
80
+ 2025-09-23 09:40:54.733+09:00 DebugTrace-rb 1.3.2 on Ruby 3.4.6 / x86_64-linux
81
+ 2025-09-23 09:40:54.733+09:00 config file: ./debugtrace.yml
82
+ 2025-09-23 09:40:54.733+09:00 logger: StdErrLogger
83
+ 2025-09-23 09:40:54.733+09:00
84
+ 2025-09-23 09:40:54.733+09:00 ______________________________ #72 ______________________________
85
+ 2025-09-23 09:40:54.733+09:00
86
+ 2025-09-23 09:40:54.733+09:00 Enter func1 (examples/readme-example.rb:29) <- <main> (examples/readme-example.rb:35)
87
+ 2025-09-23 09:40:54.733+09:00 | Hello, World! (examples/readme-example.rb:30)
88
+ 2025-09-23 09:40:54.733+09:00 | Enter func2 (examples/readme-example.rb:20) <- func1 (examples/readme-example.rb:31)
89
+ 2025-09-23 09:40:54.734+09:00 | | Enter Contact#initialize (examples/readme-example.rb:10) <- Class#new (examples/readme-example.rb:22)
90
+ 2025-09-23 09:40:54.734+09:00 | | Leave Contact#initialize (examples/readme-example.rb:15) duration: 0.014 ms
91
+ 2025-09-23 09:40:54.734+09:00 | |
92
+ 2025-09-23 09:40:54.734+09:00 | | Enter Contact#initialize (examples/readme-example.rb:10) <- Class#new (examples/readme-example.rb:23)
93
+ 2025-09-23 09:40:54.734+09:00 | | Leave Contact#initialize (examples/readme-example.rb:15) duration: 0.007 ms
94
+ 2025-09-23 09:40:54.734+09:00 | Leave func2 (examples/readme-example.rb:25) duration: 0.206 ms
95
+ 2025-09-23 09:40:54.734+09:00 Leave func1 (examples/readme-example.rb:32) duration: 0.332 ms
96
+ 2025-09-23 09:40:54.734+09:00
97
+ 2025-09-23 09:40:54.734+09:00 contacts = [
98
+ 2025-09-23 09:40:54.734+09:00 Contact{
99
+ 2025-09-23 09:40:54.734+09:00 @id: 1, @firstName: 'Akane', @lastName: 'Apple', @birthday: 1991-02-03
100
+ 2025-09-23 09:40:54.734+09:00 },
101
+ 2025-09-23 09:40:54.734+09:00 Contact{
102
+ 2025-09-23 09:40:54.734+09:00 @id: 2, @firstName: 'Yukari', @lastName: 'Apple',
103
+ 2025-09-23 09:40:54.734+09:00 @birthday: 1992-03-04
104
+ 2025-09-23 09:40:54.734+09:00 }
105
+ 2025-09-23 09:40:54.734+09:00 ] (examples/readme-example.rb:36)
106
106
  ```
107
107
 
108
108
  ### 4. メソッド一覧
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+ # enumerable-example.rb
3
+ #require 'debugtrace'
4
+ require_relative '../lib/debugtrace'
5
+
6
+ # Array
7
+ array1 = [1, 2, 3, 4]
8
+ DebugTrace.print('array1', array1)
9
+ DebugTrace.print('array1.to_s', array1.to_s)
10
+
11
+ array2 = [:a, 'B', "C\n", 4]
12
+ DebugTrace.print('array2', array2)
13
+ DebugTrace.print('array2.to_s', array2.to_s)
14
+
15
+ # Hash
16
+ hash1 = {'a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => "D\n"}
17
+ DebugTrace.print('hash1', hash1)
18
+ DebugTrace.print('hash1.to_s', hash1.to_s)
19
+
20
+ hash2 = {a: 'A', b: 'B', c: 'C', d: "D\n"}
21
+ DebugTrace.print('hash2', hash2)
22
+ DebugTrace.print('hash2.to_s', hash2.to_s)
23
+
24
+ # Set
25
+ set1 = Set.new([1, 2, 3, 4])
26
+ DebugTrace.print('set1', set1)
27
+ DebugTrace.print('set1.to_s', set1.to_s)
@@ -4,6 +4,7 @@
4
4
 
5
5
  # Contains source location information.
6
6
  class Location
7
+ @@current_dir = Dir.pwd + '/'
7
8
  attr_reader :name
8
9
  attr_reader :path
9
10
  attr_reader :lineno
@@ -22,6 +23,9 @@ class Location
22
23
  @name = caller_location.base_label
23
24
  end
24
25
  @path = caller_location.path || 'unknown'
26
+ if @path.start_with?(@@current_dir)
27
+ @path = @path[@@current_dir.length..-1]
28
+ end
25
29
  @lineno = caller_location.lineno
26
30
  end
27
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DebugTrace
4
- VERSION = '1.3.1'
4
+ VERSION = '1.3.2'
5
5
  end
data/lib/debugtrace.rb CHANGED
@@ -78,7 +78,7 @@ module DebugTrace
78
78
 
79
79
  return unless @@config.enabled?
80
80
 
81
- @@logger.print("DebugTrace-rb #{DebugTrace::VERSION} on Ruby #{RUBY_VERSION}")
81
+ @@logger.print("DebugTrace-rb #{DebugTrace::VERSION} on Ruby #{RUBY_VERSION} / #{RUBY_PLATFORM}")
82
82
  @@logger.print(" config file: #{config_path}")
83
83
  @@logger.print(" logger: #{@@logger}")
84
84
  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.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masato Kokubo
@@ -26,6 +26,7 @@ files:
26
26
  - README_ja.md
27
27
  - Rakefile
28
28
  - examples/debugtrace.yml
29
+ - examples/enumerable-example.rb
29
30
  - examples/readme-example.rb
30
31
  - lib/debugtrace.rb
31
32
  - lib/debugtrace/common.rb
@@ -57,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
58
  - !ruby/object:Gem::Version
58
59
  version: '0'
59
60
  requirements: []
60
- rubygems_version: 3.6.9
61
+ rubygems_version: 3.7.2
61
62
  specification_version: 4
62
63
  summary: DebugTrace-rb is a library that helps debug ruby programs.
63
64
  test_files: []