debug_helper 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +22 -22
  3. data/README.md +848 -218
  4. data/lib/debug_helper.rb +79 -160
  5. data/lib/debug_helper/array_handler.rb +12 -0
  6. data/lib/debug_helper/dir_handler.rb +19 -0
  7. data/lib/debug_helper/each_pair_handler.rb +13 -0
  8. data/lib/debug_helper/each_with_index_handler.rb +11 -0
  9. data/lib/debug_helper/exception_handler.rb +14 -0
  10. data/lib/debug_helper/file_handler.rb +29 -0
  11. data/lib/debug_helper/generic_handler.rb +12 -0
  12. data/lib/debug_helper/handler.rb +102 -0
  13. data/lib/debug_helper/hash_handler.rb +19 -0
  14. data/lib/debug_helper/io_handler.rb +15 -0
  15. data/lib/debug_helper/match_data_handler.rb +17 -0
  16. data/lib/debug_helper/object_handler.rb +13 -0
  17. data/lib/debug_helper/open_struct_handler.rb +16 -0
  18. data/lib/debug_helper/range_handler.rb +14 -0
  19. data/lib/debug_helper/regexp_handler.rb +16 -0
  20. data/lib/debug_helper/set_handler.rb +12 -0
  21. data/lib/debug_helper/string_handler.rb +17 -0
  22. data/lib/debug_helper/struct_handler.rb +18 -0
  23. data/lib/debug_helper/symbol_handler.rb +15 -0
  24. data/lib/debug_helper/version.rb +3 -3
  25. data/markdown/readme/Rakefile +36 -6
  26. data/markdown/readme/class_inclusions.md +10 -3
  27. data/markdown/readme/class_links.md +10 -3
  28. data/markdown/readme/classes/array/circular/show.md +4 -2
  29. data/markdown/readme/classes/array/circular/show.yaml +4 -2
  30. data/markdown/readme/classes/array/mixed/show.md +6 -3
  31. data/markdown/readme/classes/array/mixed/show.yaml +6 -3
  32. data/markdown/readme/classes/array/nested/show.md +6 -3
  33. data/markdown/readme/classes/array/nested/show.yaml +6 -3
  34. data/markdown/readme/classes/array/simple/show.md +2 -1
  35. data/markdown/readme/classes/array/simple/show.yaml +2 -1
  36. data/markdown/readme/classes/dir/simple/show.md +28 -0
  37. data/markdown/readme/classes/dir/simple/show.rb +4 -0
  38. data/markdown/readme/classes/dir/simple/show.yaml +11 -0
  39. data/markdown/readme/classes/dir/simple/template.md +9 -0
  40. data/markdown/readme/classes/dir/template.md +3 -0
  41. data/markdown/readme/classes/exception/simple/show.md +44 -0
  42. data/markdown/readme/classes/exception/simple/show.rb +22 -0
  43. data/markdown/readme/classes/exception/simple/show.yaml +9 -0
  44. data/markdown/readme/classes/exception/simple/template.md +9 -0
  45. data/markdown/readme/classes/exception/template.md +3 -0
  46. data/markdown/readme/classes/file/simple/show.md +3 -3
  47. data/markdown/readme/classes/file/simple/show.yaml +3 -3
  48. data/markdown/readme/classes/hash/circular/show.md +12 -4
  49. data/markdown/readme/classes/hash/circular/show.yaml +12 -4
  50. data/markdown/readme/classes/hash/mixed/show.md +14 -6
  51. data/markdown/readme/classes/hash/mixed/show.yaml +14 -6
  52. data/markdown/readme/classes/hash/nested/show.md +24 -9
  53. data/markdown/readme/classes/hash/nested/show.yaml +24 -9
  54. data/markdown/readme/classes/hash/simple/show.md +10 -4
  55. data/markdown/readme/classes/hash/simple/show.yaml +10 -4
  56. data/markdown/readme/classes/io/simple/show.md +23 -0
  57. data/markdown/readme/classes/io/simple/show.rb +4 -0
  58. data/markdown/readme/classes/io/simple/show.yaml +6 -0
  59. data/markdown/readme/classes/io/simple/template.md +9 -0
  60. data/markdown/readme/classes/io/template.md +3 -0
  61. data/markdown/readme/classes/match_data/multiple_captures/show.md +33 -0
  62. data/markdown/readme/classes/match_data/multiple_captures/show.rb +4 -0
  63. data/markdown/readme/classes/match_data/multiple_captures/show.yaml +16 -0
  64. data/markdown/readme/classes/match_data/multiple_captures/template.md +9 -0
  65. data/markdown/readme/classes/match_data/named_captures/show.md +31 -0
  66. data/markdown/readme/classes/match_data/named_captures/show.rb +4 -0
  67. data/markdown/readme/classes/match_data/named_captures/show.yaml +14 -0
  68. data/markdown/readme/classes/match_data/named_captures/template.md +9 -0
  69. data/markdown/readme/classes/match_data/simple/show.md +25 -0
  70. data/markdown/readme/classes/match_data/simple/show.rb +4 -0
  71. data/markdown/readme/classes/match_data/simple/show.yaml +8 -0
  72. data/markdown/readme/classes/match_data/simple/template.md +9 -0
  73. data/markdown/readme/classes/match_data/template.md +7 -0
  74. data/markdown/readme/classes/object/object/show.md +23 -0
  75. data/markdown/readme/classes/object/object/show.rb +8 -0
  76. data/markdown/readme/classes/object/object/show.yaml +2 -0
  77. data/markdown/readme/classes/object/object/template.md +9 -0
  78. data/markdown/readme/classes/object/template.md +1 -7
  79. data/markdown/readme/classes/open_struct/circular/show.md +40 -0
  80. data/markdown/readme/classes/open_struct/circular/show.rb +8 -0
  81. data/markdown/readme/classes/open_struct/circular/show.yaml +17 -0
  82. data/markdown/readme/classes/open_struct/circular/template.md +11 -0
  83. data/markdown/readme/classes/open_struct/mixed/show.md +51 -0
  84. data/markdown/readme/classes/open_struct/mixed/show.rb +5 -0
  85. data/markdown/readme/classes/open_struct/mixed/show.yaml +33 -0
  86. data/markdown/readme/classes/open_struct/mixed/template.md +9 -0
  87. data/markdown/readme/classes/open_struct/nested/show.md +73 -0
  88. data/markdown/readme/classes/open_struct/nested/show.rb +14 -0
  89. data/markdown/readme/classes/open_struct/nested/show.yaml +46 -0
  90. data/markdown/readme/classes/open_struct/nested/template.md +9 -0
  91. data/markdown/readme/classes/open_struct/simple/show.md +41 -0
  92. data/markdown/readme/classes/open_struct/simple/show.rb +5 -0
  93. data/markdown/readme/classes/open_struct/simple/show.yaml +23 -0
  94. data/markdown/readme/classes/open_struct/simple/template.md +9 -0
  95. data/markdown/readme/classes/open_struct/template.md +9 -0
  96. data/markdown/readme/classes/range/exclude_end/show.md +22 -0
  97. data/markdown/readme/classes/range/exclude_end/show.rb +4 -0
  98. data/markdown/readme/classes/range/exclude_end/show.yaml +5 -0
  99. data/markdown/readme/classes/range/exclude_end/template.md +9 -0
  100. data/markdown/readme/classes/range/include_end/show.md +22 -0
  101. data/markdown/readme/classes/range/include_end/show.rb +4 -0
  102. data/markdown/readme/classes/range/include_end/show.yaml +5 -0
  103. data/markdown/readme/classes/range/include_end/template.md +9 -0
  104. data/markdown/readme/classes/range/template.md +5 -0
  105. data/markdown/readme/classes/regexp/named_captures/show.md +28 -0
  106. data/markdown/readme/classes/regexp/named_captures/show.rb +4 -0
  107. data/markdown/readme/classes/regexp/named_captures/show.yaml +11 -0
  108. data/markdown/readme/classes/regexp/named_captures/template.md +9 -0
  109. data/markdown/readme/classes/regexp/simple/show.md +24 -0
  110. data/markdown/readme/classes/regexp/simple/show.rb +4 -0
  111. data/markdown/readme/classes/regexp/simple/show.yaml +7 -0
  112. data/markdown/readme/classes/regexp/simple/template.md +9 -0
  113. data/markdown/readme/classes/regexp/template.md +5 -0
  114. data/markdown/readme/classes/set/circular/show.md +4 -2
  115. data/markdown/readme/classes/set/circular/show.yaml +4 -2
  116. data/markdown/readme/classes/set/mixed/show.md +6 -3
  117. data/markdown/readme/classes/set/mixed/show.yaml +6 -3
  118. data/markdown/readme/classes/set/nested/show.md +6 -3
  119. data/markdown/readme/classes/set/nested/show.yaml +6 -3
  120. data/markdown/readme/classes/set/simple/show.md +2 -1
  121. data/markdown/readme/classes/set/simple/show.yaml +2 -1
  122. data/markdown/readme/classes/string/multiline/show.md +2 -1
  123. data/markdown/readme/classes/string/multiline/show.yaml +2 -1
  124. data/markdown/readme/classes/string/simple/show.md +2 -1
  125. data/markdown/readme/classes/string/simple/show.yaml +2 -1
  126. data/markdown/readme/classes/struct/circular/show.md +34 -8
  127. data/markdown/readme/classes/struct/circular/show.yaml +34 -8
  128. data/markdown/readme/classes/struct/mixed/show.md +21 -6
  129. data/markdown/readme/classes/struct/mixed/show.yaml +21 -6
  130. data/markdown/readme/classes/struct/nested/show.md +36 -9
  131. data/markdown/readme/classes/struct/nested/show.yaml +36 -9
  132. data/markdown/readme/classes/struct/simple/show.md +17 -4
  133. data/markdown/readme/classes/struct/simple/show.yaml +17 -4
  134. data/markdown/readme/classes/symbol/simple/show.md +2 -1
  135. data/markdown/readme/classes/symbol/simple/show.yaml +2 -1
  136. data/markdown/readme/options/depth/show.md +30 -15
  137. data/markdown/readme/options/depth/show.yaml +30 -15
  138. data/markdown/readme/template.md +8 -8
  139. metadata +88 -14
  140. data/markdown/readme/classes/object/datetime/show.md +0 -18
  141. data/markdown/readme/classes/object/datetime/show.rb +0 -4
  142. data/markdown/readme/classes/object/datetime/show.yaml +0 -1
  143. data/markdown/readme/classes/object/datetime/template.md +0 -9
  144. data/markdown/readme/classes/object/range/show.md +0 -19
  145. data/markdown/readme/classes/object/range/show.rb +0 -4
  146. data/markdown/readme/classes/object/range/show.yaml +0 -2
  147. data/markdown/readme/classes/object/range/template.md +0 -9
  148. data/markdown/readme/classes/object/regexp/show.md +0 -19
  149. data/markdown/readme/classes/object/regexp/show.rb +0 -4
  150. data/markdown/readme/classes/object/regexp/show.yaml +0 -2
  151. data/markdown/readme/classes/object/regexp/template.md +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 046cfef48272f5af4958be3ef459f40acfbbaf44
4
- data.tar.gz: c2fcde6be53604dff5157586373826e78d0b20bc
3
+ metadata.gz: b96c161aefd3636445bc0a68e63f815057037060
4
+ data.tar.gz: 9c6de8c9b4f3d358d404a60437a5a4ccbda7894e
5
5
  SHA512:
6
- metadata.gz: 17083bc4f2add3f38ce66b69a100784e9b26af5be6e64386e4a89324549ba4e0cfcc2c6f22c60d5f2d08ae69b0d1f81d86ffcb5462bd5e7b44208466cf7ecd0e
7
- data.tar.gz: ff9755d3b0ebee673b81cd0acf624cb4b619eede892b7c208ca326fe7f21028de77c1c0cc5e346452719c63883fd17a4c2352ab82b0212301ac7c2f2f9a8eaa3
6
+ metadata.gz: dd4ff02ad1a77f4c2163cabd5d02c6cee83d6570e2ae2ef33bb674ac984a94ccf994f4307ddc1762df288edcae77aa0543e21b437e4e55a50bcc36f9438fbc70
7
+ data.tar.gz: bdca4596038096b29f17a7e82c4f4488af737f50c23a50f3d7ae20ab7d2cfc84c2f708cd660c66b12bbdba0fa2eacbac28c20ebafbe9d24f2c7442386031107b
data/Gemfile.lock CHANGED
@@ -1,22 +1,22 @@
1
- PATH
2
- remote: .
3
- specs:
4
- debug_helper (1.7.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- minitest (5.11.3)
10
- rake (10.5.0)
11
-
12
- PLATFORMS
13
- x64-mingw32
14
-
15
- DEPENDENCIES
16
- bundler (~> 1.16)
17
- debug_helper!
18
- minitest (~> 5.0)
19
- rake (~> 10.0)
20
-
21
- BUNDLED WITH
22
- 1.16.2
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ debug_helper (1.8.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ minitest (5.11.3)
10
+ rake (10.5.0)
11
+
12
+ PLATFORMS
13
+ x64-mingw32
14
+
15
+ DEPENDENCIES
16
+ bundler (~> 1.16)
17
+ debug_helper!
18
+ minitest (~> 5.0)
19
+ rake (~> 10.0)
20
+
21
+ BUNDLED WITH
22
+ 1.16.2
data/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # Debug Helper
2
2
 
3
- ## New in Version 1.7
3
+ ## New in Version 1.8
4
4
 
5
5
  Classes analyzed:
6
6
 
7
- - [File](#file)
8
- - [Set](#set)
9
-
10
- Options:
11
-
12
- - [```depth```](#option-depth)
7
+ - [Dir](#dir)
8
+ - [Exception](#exception)
9
+ - [Range](#range)
10
+ - [Regexp](#regexp)
11
+ - [IO](#io)
12
+ - [MatchData](#matchdata)
13
13
 
14
14
  ## About Debug Helper
15
15
 
@@ -35,19 +35,26 @@ This helper assists in debugging by printing an analysis of a given object. The
35
35
 
36
36
  For certain classes (see below), the analysis is very detailed.
37
37
 
38
- For the collection classes ```Array```, ```Hash```, and ```Struct```, the analysis is also recursive; that is, the collection's values are themselves analyzed.
38
+ For the collection classes ```Array```, ```Hash```, ```Struct```, ```Set```, and ```OpenStruct```, the analysis is also recursive; that is, the collection's values are themselves analyzed.
39
39
 
40
40
  You can control the depth of recursion using option ```depth```. See [Options](#options).
41
41
 
42
42
  Classes treated in detail:
43
43
 
44
44
  - [Array](#array)
45
+ - [Dir](#dir)
46
+ - [Exception](#exception)
47
+ - [File](#file)
45
48
  - [Hash](#hash)
46
- - [Struct](#struct)
49
+ - [IO](#io)
50
+ - [MatchData](#matchdata)
51
+ - [OpenStruct](#openstruct)
52
+ - [Range](#range)
53
+ - [Regexp](#regexp)
54
+ - [Set](#set)
47
55
  - [String](#string)
56
+ - [Struct](#struct)
48
57
  - [Symbol](#symbol)
49
- - [File](#file)
50
- - [Set](#set)
51
58
 
52
59
  Others are treated as:
53
60
 
@@ -91,7 +98,8 @@ The output shows details of the array.
91
98
  ```show.yaml```:
92
99
  ```yaml
93
100
  ---
94
- Array (message='My simple array' size=3):
101
+ Array (message='My simple array'):
102
+ size: 3
95
103
  Element 0: Fixnum 5
96
104
  Element 1: Fixnum 10
97
105
  Element 2: Fixnum 15
@@ -114,17 +122,20 @@ The output shows details of the array.
114
122
  ```show.yaml```:
115
123
  ```yaml
116
124
  ---
117
- Array (message='My mixed array' size=3):
125
+ Array (message='My mixed array'):
126
+ size: 3
118
127
  Element 0: Fixnum 0
119
128
  Element 1:
120
- String (size=3):
129
+ String:
121
130
  to_s: one
131
+ size: 3
122
132
  encoding: !ruby/encoding UTF-8
123
133
  ascii_only?: true
124
134
  bytesize: 3
125
135
  Element 2:
126
- Symbol (size=3):
136
+ Symbol:
127
137
  to_s: two
138
+ size: 3
128
139
  encoding: !ruby/encoding US-ASCII
129
140
  ```
130
141
 
@@ -145,14 +156,17 @@ The output shows details of the arrays.
145
156
  ```show.yaml```:
146
157
  ```yaml
147
158
  ---
148
- Array (message='My nested arrays' size=3):
159
+ Array (message='My nested arrays'):
160
+ size: 3
149
161
  Element 0: Fixnum 0
150
162
  Element 1:
151
- Array (size=2):
163
+ Array:
164
+ size: 2
152
165
  Element 0: Fixnum 1
153
166
  Element 1: Fixnum 2
154
167
  Element 2:
155
- Array (size=2):
168
+ Array:
169
+ size: 2
156
170
  Element 0: Fixnum 3
157
171
  Element 1: Fixnum 4
158
172
  ```
@@ -179,11 +193,127 @@ The circular reference is not followed.
179
193
  ```show.yaml```:
180
194
  ```yaml
181
195
  ---
182
- Array (message='My circular arrays' size=1):
196
+ Array (message='My circular arrays'):
197
+ size: 1
183
198
  Element 0:
184
- Array (size=1):
199
+ Array:
200
+ size: 1
185
201
  Element 0: Array [[[...]]]
186
202
  ```
203
+ ### Dir
204
+
205
+ #### Simple Dir
206
+
207
+ This example shows a simple ```Dir```.
208
+
209
+ ```show.rb```:
210
+ ```ruby
211
+ require 'debug_helper'
212
+
213
+ dir = Dir.new(File.dirname(__FILE__))
214
+ DebugHelper.show(dir, 'My simple dir')
215
+ ```
216
+
217
+ The output shows details of the ```Dir```.
218
+
219
+ ```show.yaml```:
220
+ ```yaml
221
+ ---
222
+ Dir (message='My simple dir'):
223
+ path: "."
224
+ entries:
225
+ - "."
226
+ - ".."
227
+ - show.md
228
+ - show.rb
229
+ - show.yaml
230
+ - template.md
231
+ exist?: true
232
+ ```
233
+ ### Exception
234
+
235
+ #### Simple Exception
236
+
237
+ This example shows a simple ```Exception```.
238
+
239
+ ```show.rb```:
240
+ ```ruby
241
+ require 'debug_helper'
242
+
243
+ def foo
244
+ exception = nil
245
+ begin
246
+ raise Exception.new('Boo!')
247
+ rescue Exception => exception
248
+ # Already saved.
249
+ end
250
+ DebugHelper.show(exception, 'My simple exception')
251
+ end
252
+
253
+ def bar
254
+ foo
255
+ end
256
+
257
+ def baz
258
+ bar
259
+ end
260
+
261
+ baz
262
+
263
+ ```
264
+
265
+ The output shows details of the ```Exception```.
266
+
267
+ ```show.yaml```:
268
+ ```yaml
269
+ ---
270
+ Exception (message='My simple exception'):
271
+ message: Boo!
272
+ cause:
273
+ backtrace:
274
+ - show.rb:6:in `foo'
275
+ - show.rb:14:in `bar'
276
+ - show.rb:18:in `baz'
277
+ - show.rb:21:in `<main>'
278
+ ```
279
+ ### File
280
+
281
+ #### Simple File
282
+
283
+ This example shows a simple file.
284
+
285
+ ```show.rb```:
286
+ ```ruby
287
+ require 'debug_helper'
288
+
289
+ file = File.new(__FILE__)
290
+ DebugHelper.show(file, 'My simple file')
291
+ ```
292
+
293
+ The output shows details of the file.
294
+
295
+ ```show.yaml```:
296
+ ```yaml
297
+ ---
298
+ File (message='My simple file'):
299
+ absolute_path: C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
300
+ atime: 2018-07-14 12:45:32.000000000 -05:00
301
+ ctime: 2018-07-14 12:45:32.000000000 -05:00
302
+ executable?: false
303
+ exist?: true
304
+ ftype: file
305
+ mtime: 2018-07-14 12:45:32.000000000 -05:00
306
+ path: show.rb
307
+ pipe?: false
308
+ readable?: true
309
+ realpath: C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
310
+ setgid?: false
311
+ setuid?: false
312
+ size: 95
313
+ socket?: false
314
+ symlink?: false
315
+ writable?: true
316
+ ```
187
317
  ### Hash
188
318
 
189
319
  #### Simple Hash
@@ -203,23 +333,29 @@ The output shows details of the hash.
203
333
  ```show.yaml```:
204
334
  ```yaml
205
335
  ---
206
- Hash (size=3 message='My simple hash'):
336
+ Hash (message='My simple hash'):
337
+ size: 3
338
+ default:
339
+ default_proc:
207
340
  Pair 0:
208
341
  Key:
209
- Symbol (size=1):
342
+ Symbol:
210
343
  to_s: a
344
+ size: 1
211
345
  encoding: !ruby/encoding US-ASCII
212
346
  Value: Fixnum 0
213
347
  Pair 1:
214
348
  Key:
215
- Symbol (size=1):
349
+ Symbol:
216
350
  to_s: b
351
+ size: 1
217
352
  encoding: !ruby/encoding US-ASCII
218
353
  Value: Fixnum 1
219
354
  Pair 2:
220
355
  Key:
221
- Symbol (size=1):
356
+ Symbol:
222
357
  to_s: c
358
+ size: 1
223
359
  encoding: !ruby/encoding US-ASCII
224
360
  Value: Fixnum 2
225
361
  ```
@@ -245,32 +381,40 @@ The output shows details of the hash.
245
381
  ```show.yaml```:
246
382
  ```yaml
247
383
  ---
248
- Hash (size=3 message='My mixed hash'):
384
+ Hash (message='My mixed hash'):
385
+ size: 3
386
+ default:
387
+ default_proc:
249
388
  Pair 0:
250
389
  Key:
251
- Symbol (size=1):
390
+ Symbol:
252
391
  to_s: a
392
+ size: 1
253
393
  encoding: !ruby/encoding US-ASCII
254
394
  Value: Fixnum 0
255
395
  Pair 1:
256
396
  Key:
257
- Symbol (size=1):
397
+ Symbol:
258
398
  to_s: b
399
+ size: 1
259
400
  encoding: !ruby/encoding US-ASCII
260
401
  Value:
261
- String (size=3):
402
+ String:
262
403
  to_s: one
404
+ size: 3
263
405
  encoding: !ruby/encoding UTF-8
264
406
  ascii_only?: true
265
407
  bytesize: 3
266
408
  Pair 2:
267
409
  Key:
268
- Symbol (size=1):
410
+ Symbol:
269
411
  to_s: c
412
+ size: 1
270
413
  encoding: !ruby/encoding US-ASCII
271
414
  Value:
272
- Symbol (size=3):
415
+ Symbol:
273
416
  to_s: two
417
+ size: 3
274
418
  encoding: !ruby/encoding US-ASCII
275
419
  ```
276
420
 
@@ -300,43 +444,58 @@ The output shows details of the hashes.
300
444
  ```show.yaml```:
301
445
  ```yaml
302
446
  ---
303
- Hash (size=2 message='My nested hash'):
447
+ Hash (message='My nested hash'):
448
+ size: 2
449
+ default:
450
+ default_proc:
304
451
  Pair 0:
305
452
  Key:
306
- Symbol (size=1):
453
+ Symbol:
307
454
  to_s: a
455
+ size: 1
308
456
  encoding: !ruby/encoding US-ASCII
309
457
  Value:
310
- Hash (size=2):
458
+ Hash:
459
+ size: 2
460
+ default:
461
+ default_proc:
311
462
  Pair 0:
312
463
  Key:
313
- Symbol (size=1):
464
+ Symbol:
314
465
  to_s: b
466
+ size: 1
315
467
  encoding: !ruby/encoding US-ASCII
316
468
  Value: Fixnum 0
317
469
  Pair 1:
318
470
  Key:
319
- Symbol (size=1):
471
+ Symbol:
320
472
  to_s: c
473
+ size: 1
321
474
  encoding: !ruby/encoding US-ASCII
322
475
  Value: Fixnum 1
323
476
  Pair 1:
324
477
  Key:
325
- Symbol (size=1):
478
+ Symbol:
326
479
  to_s: d
480
+ size: 1
327
481
  encoding: !ruby/encoding US-ASCII
328
482
  Value:
329
- Hash (size=2):
483
+ Hash:
484
+ size: 2
485
+ default:
486
+ default_proc:
330
487
  Pair 0:
331
488
  Key:
332
- Symbol (size=1):
489
+ Symbol:
333
490
  to_s: e
491
+ size: 1
334
492
  encoding: !ruby/encoding US-ASCII
335
493
  Value: Fixnum 2
336
494
  Pair 1:
337
495
  Key:
338
- Symbol (size=1):
496
+ Symbol:
339
497
  to_s: f
498
+ size: 1
340
499
  encoding: !ruby/encoding US-ASCII
341
500
  Value: Fixnum 3
342
501
  ```
@@ -363,293 +522,458 @@ The circular reference is not followed.
363
522
  ```show.yaml```:
364
523
  ```yaml
365
524
  ---
366
- Hash (size=1 message='My circular hashes'):
525
+ Hash (message='My circular hashes'):
526
+ size: 1
527
+ default:
528
+ default_proc:
367
529
  Pair 0:
368
530
  Key:
369
- Symbol (size=3):
531
+ Symbol:
370
532
  to_s: foo
533
+ size: 3
371
534
  encoding: !ruby/encoding US-ASCII
372
535
  Value:
373
- Hash (size=1):
536
+ Hash:
537
+ size: 1
538
+ default:
539
+ default_proc:
374
540
  Pair 0:
375
541
  Key:
376
- Symbol (size=3):
542
+ Symbol:
377
543
  to_s: bar
544
+ size: 3
378
545
  encoding: !ruby/encoding US-ASCII
379
546
  Value: Hash {:foo=>{:bar=>{...}}}
380
547
  ```
381
- ### Struct
548
+ ### IO
382
549
 
383
- #### Simple Struct
550
+ #### Simple IO
384
551
 
385
- This example shows a simple struct.
552
+ This example shows a simple ```IO```.
386
553
 
387
554
  ```show.rb```:
388
555
  ```ruby
389
556
  require 'debug_helper'
390
557
 
391
- MyStruct = Struct.new(:a, :b, :c)
392
- struct = MyStruct.new(0, 1, 2)
393
- DebugHelper.show(struct, 'My simple struct')
558
+ io = IO.new(IO.sysopen(__FILE__, 'r'), 'r')
559
+ DebugHelper.show(io, 'My simple io')
394
560
  ```
395
561
 
396
- The output shows details of the struct.
562
+ The output shows details of the ```IO```.
563
+
564
+ ```show.yaml```:
565
+ ```yaml
566
+ ---
567
+ IO (message='My simple io'):
568
+ autoclose?: true
569
+ binmode?: false
570
+ closed?: false
571
+ tty?: false
572
+ ```
573
+ ### MatchData
574
+
575
+ #### Simple MatchData
576
+
577
+ This example shows a simple ```MatchData```.
578
+
579
+ ```show.rb```:
580
+ ```ruby
581
+ require 'debug_helper'
582
+
583
+ match_data = /[a-z]/.match('abc')
584
+ DebugHelper.show(match_data, 'My simple MatchData')
585
+ ```
586
+
587
+ The output shows details of the ```MatchData```.
588
+
589
+ ```show.yaml```:
590
+ ```yaml
591
+ ---
592
+ MatchData (message='My simple MatchData'):
593
+ size: 1
594
+ regexp: !ruby/regexp /[a-z]/
595
+ to_a:
596
+ - a
597
+ captures: []
598
+ names: []
599
+ ```
600
+
601
+ #### Multiple Captures
602
+
603
+ This example shows a ```MatchData``` with multiple captures.
604
+
605
+ ```show.rb```:
606
+ ```ruby
607
+ require 'debug_helper'
608
+
609
+ match_data = /(.)(.)(\d+)(\d)/.match('THX1138.')
610
+ DebugHelper.show(match_data, 'My MatchData with named captures')
611
+ ```
612
+
613
+ The output shows details of the ```MatchData```.
397
614
 
398
615
  ```show.yaml```:
399
616
  ```yaml
400
617
  ---
401
- MyStruct (message='My simple struct' size=3):
618
+ MatchData (message='My MatchData with named captures'):
619
+ size: 5
620
+ regexp: !ruby/regexp /(.)(.)(\d+)(\d)/
621
+ to_a:
622
+ - HX1138
623
+ - H
624
+ - X
625
+ - '113'
626
+ - '8'
627
+ captures:
628
+ - H
629
+ - X
630
+ - '113'
631
+ - '8'
632
+ names: []
633
+ ```
634
+
635
+ #### Named Captures
636
+
637
+ This example shows a ```MatchData``` with named captures.
638
+
639
+ ```show.rb```:
640
+ ```ruby
641
+ require 'debug_helper'
642
+
643
+ match_data = /(?<x>.)(?<y>.)?/.match("a")
644
+ DebugHelper.show(match_data, 'My MatchData with named captures')
645
+ ```
646
+
647
+ The output shows details of the ```MatchData```.
648
+
649
+ ```show.yaml```:
650
+ ```yaml
651
+ ---
652
+ MatchData (message='My MatchData with named captures'):
653
+ size: 3
654
+ regexp: !ruby/regexp /(?<x>.)(?<y>.)?/
655
+ to_a:
656
+ - a
657
+ - a
658
+ -
659
+ captures:
660
+ - a
661
+ -
662
+ names:
663
+ - x
664
+ - y
665
+ ```
666
+ ### OpenStruct
667
+
668
+ #### Simple OpenStruct
669
+
670
+ This example shows a simple open struct.
671
+
672
+ ```show.rb```:
673
+ ```ruby
674
+ require 'ostruct'
675
+ require 'debug_helper'
676
+
677
+ ostruct = OpenStruct.new(:a => 0, :b => 1, :c => 2)
678
+ DebugHelper.show(ostruct, 'My simple struct')
679
+ ```
680
+
681
+ The output shows details of the open struct.
682
+
683
+ ```show.yaml```:
684
+ ```yaml
685
+ ---
686
+ OpenStruct (message='My simple struct'):
402
687
  Member 0:
403
- Name: :a
688
+ Name:
689
+ Symbol:
690
+ to_s: a
691
+ size: 1
692
+ encoding: !ruby/encoding US-ASCII
404
693
  Value: Fixnum 0
405
694
  Member 1:
406
- Name: :b
695
+ Name:
696
+ Symbol:
697
+ to_s: b
698
+ size: 1
699
+ encoding: !ruby/encoding US-ASCII
407
700
  Value: Fixnum 1
408
701
  Member 2:
409
- Name: :c
702
+ Name:
703
+ Symbol:
704
+ to_s: c
705
+ size: 1
706
+ encoding: !ruby/encoding US-ASCII
410
707
  Value: Fixnum 2
411
708
  ```
412
709
 
413
- #### Mixed Struct
710
+ #### Mixed OpenStruct
414
711
 
415
- This example shows a struct of mixed values.
712
+ This example shows an open struct of mixed values.
416
713
 
417
714
  ```show.rb```:
418
715
  ```ruby
716
+ require 'ostruct'
419
717
  require 'debug_helper'
420
718
 
421
- MyStruct = Struct.new(:a, :b, :c)
422
- struct = MyStruct.new(0, 'one', :two)
423
- DebugHelper.show(struct, 'My mixed struct')
719
+ ostruct = OpenStruct.new(:a => 0, :b => 'one', :c => :two)
720
+ DebugHelper.show(ostruct, 'My mixed open struct')
424
721
  ```
425
722
 
426
- The output shows details of the struct.
723
+ The output shows details of the open struct.
427
724
 
428
725
  ```show.yaml```:
429
726
  ```yaml
430
727
  ---
431
- MyStruct (message='My mixed struct' size=3):
728
+ OpenStruct (message='My mixed open struct'):
432
729
  Member 0:
433
- Name: :a
730
+ Name:
731
+ Symbol:
732
+ to_s: a
733
+ size: 1
734
+ encoding: !ruby/encoding US-ASCII
434
735
  Value: Fixnum 0
435
736
  Member 1:
436
- Name: :b
737
+ Name:
738
+ Symbol:
739
+ to_s: b
740
+ size: 1
741
+ encoding: !ruby/encoding US-ASCII
437
742
  Value:
438
- String (size=3):
743
+ String:
439
744
  to_s: one
745
+ size: 3
440
746
  encoding: !ruby/encoding UTF-8
441
747
  ascii_only?: true
442
748
  bytesize: 3
443
749
  Member 2:
444
- Name: :c
750
+ Name:
751
+ Symbol:
752
+ to_s: c
753
+ size: 1
754
+ encoding: !ruby/encoding US-ASCII
445
755
  Value:
446
- Symbol (size=3):
756
+ Symbol:
447
757
  to_s: two
758
+ size: 3
448
759
  encoding: !ruby/encoding US-ASCII
449
760
  ```
450
761
 
451
- #### Nested Structs
762
+ #### Nested OpenStructs
452
763
 
453
- This example shows nested structs.
764
+ This example shows nested open structs.
454
765
 
455
766
  ```show.rb```:
456
767
  ```ruby
768
+ require 'ostruct'
457
769
  require 'debug_helper'
458
770
 
459
- MyStruct_0 = Struct.new(:a, :b)
460
- MyStruct_1 = Struct.new(:c, :d)
461
- struct_1a = MyStruct_1.new(2, 3)
462
- struct_1b = MyStruct_1.new(4, 5)
463
- struct_0 = MyStruct_0.new(struct_1a, struct_1b)
464
- DebugHelper.show(struct_0, 'My nested struct')
771
+ ostruct = OpenStruct.new(
772
+ :a => OpenStruct.new(
773
+ :b => 0,
774
+ :c => 1,
775
+ ),
776
+ :d => OpenStruct.new(
777
+ :e => 2,
778
+ :f => 3,
779
+ )
780
+ )
781
+ DebugHelper.show(ostruct, 'My nested struct')
465
782
  ```
466
783
 
467
- The output shows details of the structs.
784
+ The output shows details of the open structs.
468
785
 
469
786
  ```show.yaml```:
470
787
  ```yaml
471
788
  ---
472
- MyStruct_0 (message='My nested struct' size=2):
789
+ OpenStruct (message='My nested struct'):
473
790
  Member 0:
474
- Name: :a
791
+ Name:
792
+ Symbol:
793
+ to_s: a
794
+ size: 1
795
+ encoding: !ruby/encoding US-ASCII
475
796
  Value:
476
- MyStruct_1 (size=2):
797
+ OpenStruct:
477
798
  Member 0:
478
- Name: :c
479
- Value: Fixnum 2
799
+ Name:
800
+ Symbol:
801
+ to_s: b
802
+ size: 1
803
+ encoding: !ruby/encoding US-ASCII
804
+ Value: Fixnum 0
480
805
  Member 1:
481
- Name: :d
482
- Value: Fixnum 3
806
+ Name:
807
+ Symbol:
808
+ to_s: c
809
+ size: 1
810
+ encoding: !ruby/encoding US-ASCII
811
+ Value: Fixnum 1
483
812
  Member 1:
484
- Name: :b
813
+ Name:
814
+ Symbol:
815
+ to_s: d
816
+ size: 1
817
+ encoding: !ruby/encoding US-ASCII
485
818
  Value:
486
- MyStruct_1 (size=2):
819
+ OpenStruct:
487
820
  Member 0:
488
- Name: :c
489
- Value: Fixnum 4
821
+ Name:
822
+ Symbol:
823
+ to_s: e
824
+ size: 1
825
+ encoding: !ruby/encoding US-ASCII
826
+ Value: Fixnum 2
490
827
  Member 1:
491
- Name: :d
492
- Value: Fixnum 5
828
+ Name:
829
+ Symbol:
830
+ to_s: f
831
+ size: 1
832
+ encoding: !ruby/encoding US-ASCII
833
+ Value: Fixnum 3
493
834
  ```
494
835
 
495
- #### Circular Structs
836
+ #### Circular OpenStructs
496
837
 
497
- This example shows structs that make a circular reference.
838
+ This example shows open structs that make a circular reference.
498
839
 
499
840
  ```show.rb```:
500
841
  ```ruby
842
+ require 'ostruct'
501
843
  require 'debug_helper'
502
844
 
503
- MyStruct = Struct.new(:a, :b, :c)
504
- struct_0 = MyStruct.new(0, 1, 2)
505
- struct_1 = MyStruct.new(3, 4, 5)
506
- struct_0.a = struct_1
507
- struct_1.a = struct_0
508
- DebugHelper.show(struct_0, 'My circular struct')
845
+ ostruct_0 = OpenStruct.new
846
+ ostruct_1 = OpenStruct.new
847
+ ostruct_0.a = ostruct_1
848
+ ostruct_1.a = ostruct_0
849
+ DebugHelper.show(ostruct_0, 'My circular ostruct')
509
850
  ```
510
851
 
511
- The output shows details of the structs.
852
+ The output shows details of the open structs.
512
853
 
513
854
  The circular reference is not followed.
514
855
 
515
856
  ```show.yaml```:
516
857
  ```yaml
517
858
  ---
518
- MyStruct (message='My circular struct' size=3):
859
+ OpenStruct (message='My circular ostruct'):
519
860
  Member 0:
520
- Name: :a
861
+ Name:
862
+ Symbol:
863
+ to_s: a
864
+ size: 1
865
+ encoding: !ruby/encoding US-ASCII
521
866
  Value:
522
- MyStruct (size=3):
867
+ OpenStruct:
523
868
  Member 0:
524
- Name: :a
525
- Value: 'MyStruct #<struct MyStruct a=#<struct MyStruct a=#<struct MyStruct:...>,
526
- b=4, c=5>, b=1, c=2>'
527
- Member 1:
528
- Name: :b
529
- Value: Fixnum 4
530
- Member 2:
531
- Name: :c
532
- Value: Fixnum 5
533
- Member 1:
534
- Name: :b
535
- Value: Fixnum 1
536
- Member 2:
537
- Name: :c
538
- Value: Fixnum 2
869
+ Name:
870
+ Symbol:
871
+ to_s: a
872
+ size: 1
873
+ encoding: !ruby/encoding US-ASCII
874
+ Value: 'OpenStruct #<OpenStruct a=#<OpenStruct a=#<OpenStruct ...>>>'
539
875
  ```
540
- ### String
876
+ ### Range
541
877
 
542
- #### Simple String
878
+ #### Inclusive Range
543
879
 
544
- This example shows a simple string.
880
+ This example shows a ```Range``` that includes its end value.
545
881
 
546
882
  ```show.rb```:
547
883
  ```ruby
548
884
  require 'debug_helper'
549
885
 
550
- s = 'Lorem ipsum'
551
- DebugHelper.show(s, 'My simple string')
886
+ range = (0..4)
887
+ DebugHelper.show(range, 'My inclusive range')
552
888
  ```
553
889
 
554
- The output shows details of the string.
890
+ The output shows details of the ```Range```.
555
891
 
556
892
  ```show.yaml```:
557
893
  ```yaml
558
894
  ---
559
- String (message='My simple string' size=11):
560
- to_s: Lorem ipsum
561
- encoding: !ruby/encoding UTF-8
562
- ascii_only?: true
563
- bytesize: 11
895
+ Range (message='My inclusive range'):
896
+ first: 0
897
+ last: 4
898
+ exclude_end?: false
564
899
  ```
565
900
 
566
- #### Multiline String
901
+ #### Exclusive Range
567
902
 
568
- This example shows a multiline string.
903
+ This example shows a ```Range``` that excludes its end value.
569
904
 
570
905
  ```show.rb```:
571
906
  ```ruby
572
907
  require 'debug_helper'
573
908
 
574
- s = <<EOT
575
- Lorem Ipsum dolor sit amet,consectetur adipisicing elit,
576
- sed doeiusmod tempor incididunt ut laboreet dolore magna aliqua.
577
- EOT
578
- DebugHelper.show(s, 'My multiline string')
909
+ range = (0...4)
910
+ DebugHelper.show(range, 'My exclusive range')
579
911
  ```
580
912
 
581
- The output shows details of the string.
913
+ The output shows details of the ```Range```.
582
914
 
583
915
  ```show.yaml```:
584
916
  ```yaml
585
917
  ---
586
- String (message='My multiline string' size=122):
587
- to_s: |
588
- Lorem Ipsum dolor sit amet,consectetur adipisicing elit,
589
- sed doeiusmod tempor incididunt ut laboreet dolore magna aliqua.
590
- encoding: !ruby/encoding UTF-8
591
- ascii_only?: true
592
- bytesize: 122
918
+ Range (message='My exclusive range'):
919
+ first: 0
920
+ last: 4
921
+ exclude_end?: true
593
922
  ```
594
- ### Symbol
923
+ ### Regexp
595
924
 
596
- #### Simple Symbol
925
+ #### Simple Regexp
597
926
 
598
- This example shows a simple symbol.
927
+ This example shows a simple ```Regexp```.
599
928
 
600
929
  ```show.rb```:
601
930
  ```ruby
602
931
  require 'debug_helper'
603
932
 
604
- DebugHelper.show(:lorem_ipsum, 'My symbol')
933
+ regexp = Regexp.new(/\w+/)
934
+ DebugHelper.show(regexp, 'My simple regexp')
605
935
  ```
606
936
 
607
- The output shows details of the symbol.
937
+ The output shows details of the ```Regexp```.
608
938
 
609
939
  ```show.yaml```:
610
940
  ```yaml
611
941
  ---
612
- Symbol (message='My symbol' size=11):
613
- to_s: lorem_ipsum
942
+ Regexp (message='My simple regexp'):
943
+ to_s: "(?-mix:\\w+)"
944
+ casefold?: false
945
+ named_captures: {}
614
946
  encoding: !ruby/encoding US-ASCII
947
+ fixed_encoding?: false
615
948
  ```
616
- ### File
617
949
 
618
- #### Simple File
950
+ #### Named Captures
619
951
 
620
- This example shows a simple file.
952
+ This example shows a ```Regexp``` with named captures.
621
953
 
622
954
  ```show.rb```:
623
955
  ```ruby
624
956
  require 'debug_helper'
625
957
 
626
- file = File.new(__FILE__)
627
- DebugHelper.show(file, 'My simple file')
958
+ regexp = Regexp.new(/(?<a>.)(?<b>.)/)
959
+ DebugHelper.show(regexp, 'My regexp with named captures')
628
960
  ```
629
961
 
630
- The output shows details of the file.
962
+ The output shows details of the ```Regexp```.
631
963
 
632
964
  ```show.yaml```:
633
965
  ```yaml
634
966
  ---
635
- File (message='My simple file'):
636
- absolute_path: C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
637
- atime: 2018-07-13 11:44:18.000000000 -05:00
638
- ctime: 2018-07-13 11:41:01.000000000 -05:00
639
- executable?: false
640
- exist?: true
641
- ftype: file
642
- mtime: 2018-07-13 11:44:18.000000000 -05:00
643
- path: show.rb
644
- pipe?: false
645
- readable?: true
646
- realpath: C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
647
- setgid?: false
648
- setuid?: false
649
- size: 95
650
- socket?: false
651
- symlink?: false
652
- writable?: true
967
+ Regexp (message='My regexp with named captures'):
968
+ to_s: "(?-mix:(?<a>.)(?<b>.))"
969
+ casefold?: false
970
+ named_captures:
971
+ a:
972
+ - 1
973
+ b:
974
+ - 2
975
+ encoding: !ruby/encoding US-ASCII
976
+ fixed_encoding?: false
653
977
  ```
654
978
  ### Set
655
979
 
@@ -672,7 +996,8 @@ The output shows details of the set.
672
996
  ```show.yaml```:
673
997
  ```yaml
674
998
  ---
675
- Set (message='My simple set' size=3):
999
+ Set (message='My simple set'):
1000
+ size: 3
676
1001
  Element 0: Fixnum 5
677
1002
  Element 1: Fixnum 10
678
1003
  Element 2: Fixnum 15
@@ -697,17 +1022,20 @@ The output shows details of the set.
697
1022
  ```show.yaml```:
698
1023
  ```yaml
699
1024
  ---
700
- Set (message='My mixed set' size=3):
1025
+ Set (message='My mixed set'):
1026
+ size: 3
701
1027
  Element 0: Fixnum 0
702
1028
  Element 1:
703
- String (size=3):
1029
+ String:
704
1030
  to_s: one
1031
+ size: 3
705
1032
  encoding: !ruby/encoding UTF-8
706
1033
  ascii_only?: true
707
1034
  bytesize: 3
708
1035
  Element 2:
709
- Symbol (size=3):
1036
+ Symbol:
710
1037
  to_s: two
1038
+ size: 3
711
1039
  encoding: !ruby/encoding US-ASCII
712
1040
  ```
713
1041
 
@@ -734,14 +1062,17 @@ The output shows details of the sets.
734
1062
  ```show.yaml```:
735
1063
  ```yaml
736
1064
  ---
737
- Set (message='My nested sets' size=3):
1065
+ Set (message='My nested sets'):
1066
+ size: 3
738
1067
  Element 0: Fixnum 0
739
1068
  Element 1:
740
- Set (size=2):
1069
+ Set:
1070
+ size: 2
741
1071
  Element 0: Fixnum 1
742
1072
  Element 1: Fixnum 2
743
1073
  Element 2:
744
- Set (size=2):
1074
+ Set:
1075
+ size: 2
745
1076
  Element 0: Fixnum 3
746
1077
  Element 1: Fixnum 4
747
1078
  ```
@@ -770,73 +1101,357 @@ The circular reference is not followed.
770
1101
  ```show.yaml```:
771
1102
  ```yaml
772
1103
  ---
773
- Set (message='My circular sets' size=1):
1104
+ Set (message='My circular sets'):
1105
+ size: 1
774
1106
  Element 0:
775
- Set (size=1):
1107
+ Set:
1108
+ size: 1
776
1109
  Element 0: 'Set #<Set: {#<Set: {#<Set: {...}>}>}>'
777
1110
  ```
778
- ### Object
1111
+ ### String
779
1112
 
780
- Classes not mentioned above are not analyzed, but are treated more simply.
1113
+ #### Simple String
781
1114
 
782
- A few examples are shown below.
1115
+ This example shows a simple string.
783
1116
 
784
- #### DateTime
1117
+ ```show.rb```:
1118
+ ```ruby
1119
+ require 'debug_helper'
1120
+
1121
+ s = 'Lorem ipsum'
1122
+ DebugHelper.show(s, 'My simple string')
1123
+ ```
1124
+
1125
+ The output shows details of the string.
1126
+
1127
+ ```show.yaml```:
1128
+ ```yaml
1129
+ ---
1130
+ String (message='My simple string'):
1131
+ to_s: Lorem ipsum
1132
+ size: 11
1133
+ encoding: !ruby/encoding UTF-8
1134
+ ascii_only?: true
1135
+ bytesize: 11
1136
+ ```
1137
+
1138
+ #### Multiline String
785
1139
 
786
- This example shows a datetime.
1140
+ This example shows a multiline string.
787
1141
 
788
1142
  ```show.rb```:
789
1143
  ```ruby
790
1144
  require 'debug_helper'
791
1145
 
792
- datetime = DateTime.now
793
- DebugHelper.show(datetime, 'My datetime')
1146
+ s = <<EOT
1147
+ Lorem Ipsum dolor sit amet,consectetur adipisicing elit,
1148
+ sed doeiusmod tempor incididunt ut laboreet dolore magna aliqua.
1149
+ EOT
1150
+ DebugHelper.show(s, 'My multiline string')
794
1151
  ```
795
1152
 
796
- The output shows details of the datetime.
1153
+ The output shows details of the string.
797
1154
 
798
1155
  ```show.yaml```:
799
1156
  ```yaml
800
- --- 'DateTime (message=''My datetime'') #<DateTime: 2018-07-14T10:18:04-05:00 ((2458314j,55084s,502867000n),-18000s,2299161j)>'
1157
+ ---
1158
+ String (message='My multiline string'):
1159
+ to_s: |
1160
+ Lorem Ipsum dolor sit amet,consectetur adipisicing elit,
1161
+ sed doeiusmod tempor incididunt ut laboreet dolore magna aliqua.
1162
+ size: 122
1163
+ encoding: !ruby/encoding UTF-8
1164
+ ascii_only?: true
1165
+ bytesize: 122
801
1166
  ```
1167
+ ### Struct
802
1168
 
803
- #### Range
1169
+ #### Simple Struct
804
1170
 
805
- This example shows a range.
1171
+ This example shows a simple struct.
806
1172
 
807
1173
  ```show.rb```:
808
1174
  ```ruby
809
1175
  require 'debug_helper'
810
1176
 
811
- range = Range.new(0, 9)
812
- DebugHelper.show(range, 'My range')
1177
+ MyStruct = Struct.new(:a, :b, :c)
1178
+ struct = MyStruct.new(0, 1, 2)
1179
+ DebugHelper.show(struct, 'My simple struct')
813
1180
  ```
814
1181
 
815
- The output shows details of the range.
1182
+ The output shows details of the struct.
816
1183
 
817
1184
  ```show.yaml```:
818
1185
  ```yaml
819
- --- Range (message='My range') 0..9
820
- ...
1186
+ ---
1187
+ MyStruct (message='My simple struct'):
1188
+ size: 3
1189
+ Member 0:
1190
+ Name:
1191
+ Symbol:
1192
+ to_s: a
1193
+ size: 1
1194
+ encoding: !ruby/encoding US-ASCII
1195
+ Value: Fixnum 0
1196
+ Member 1:
1197
+ Name:
1198
+ Symbol:
1199
+ to_s: b
1200
+ size: 1
1201
+ encoding: !ruby/encoding US-ASCII
1202
+ Value: Fixnum 1
1203
+ Member 2:
1204
+ Name:
1205
+ Symbol:
1206
+ to_s: c
1207
+ size: 1
1208
+ encoding: !ruby/encoding US-ASCII
1209
+ Value: Fixnum 2
821
1210
  ```
822
1211
 
823
- #### Regexp
1212
+ #### Mixed Struct
824
1213
 
825
- This example shows a regexp.
1214
+ This example shows a struct of mixed values.
826
1215
 
827
1216
  ```show.rb```:
828
1217
  ```ruby
829
1218
  require 'debug_helper'
830
1219
 
831
- regexp = Regexp.new('foo')
832
- DebugHelper.show(regexp, 'My regexp')
1220
+ MyStruct = Struct.new(:a, :b, :c)
1221
+ struct = MyStruct.new(0, 'one', :two)
1222
+ DebugHelper.show(struct, 'My mixed struct')
1223
+ ```
1224
+
1225
+ The output shows details of the struct.
1226
+
1227
+ ```show.yaml```:
1228
+ ```yaml
1229
+ ---
1230
+ MyStruct (message='My mixed struct'):
1231
+ size: 3
1232
+ Member 0:
1233
+ Name:
1234
+ Symbol:
1235
+ to_s: a
1236
+ size: 1
1237
+ encoding: !ruby/encoding US-ASCII
1238
+ Value: Fixnum 0
1239
+ Member 1:
1240
+ Name:
1241
+ Symbol:
1242
+ to_s: b
1243
+ size: 1
1244
+ encoding: !ruby/encoding US-ASCII
1245
+ Value:
1246
+ String:
1247
+ to_s: one
1248
+ size: 3
1249
+ encoding: !ruby/encoding UTF-8
1250
+ ascii_only?: true
1251
+ bytesize: 3
1252
+ Member 2:
1253
+ Name:
1254
+ Symbol:
1255
+ to_s: c
1256
+ size: 1
1257
+ encoding: !ruby/encoding US-ASCII
1258
+ Value:
1259
+ Symbol:
1260
+ to_s: two
1261
+ size: 3
1262
+ encoding: !ruby/encoding US-ASCII
1263
+ ```
1264
+
1265
+ #### Nested Structs
1266
+
1267
+ This example shows nested structs.
1268
+
1269
+ ```show.rb```:
1270
+ ```ruby
1271
+ require 'debug_helper'
1272
+
1273
+ MyStruct_0 = Struct.new(:a, :b)
1274
+ MyStruct_1 = Struct.new(:c, :d)
1275
+ struct_1a = MyStruct_1.new(2, 3)
1276
+ struct_1b = MyStruct_1.new(4, 5)
1277
+ struct_0 = MyStruct_0.new(struct_1a, struct_1b)
1278
+ DebugHelper.show(struct_0, 'My nested struct')
1279
+ ```
1280
+
1281
+ The output shows details of the structs.
1282
+
1283
+ ```show.yaml```:
1284
+ ```yaml
1285
+ ---
1286
+ MyStruct_0 (message='My nested struct'):
1287
+ size: 2
1288
+ Member 0:
1289
+ Name:
1290
+ Symbol:
1291
+ to_s: a
1292
+ size: 1
1293
+ encoding: !ruby/encoding US-ASCII
1294
+ Value:
1295
+ MyStruct_1:
1296
+ size: 2
1297
+ Member 0:
1298
+ Name:
1299
+ Symbol:
1300
+ to_s: c
1301
+ size: 1
1302
+ encoding: !ruby/encoding US-ASCII
1303
+ Value: Fixnum 2
1304
+ Member 1:
1305
+ Name:
1306
+ Symbol:
1307
+ to_s: d
1308
+ size: 1
1309
+ encoding: !ruby/encoding US-ASCII
1310
+ Value: Fixnum 3
1311
+ Member 1:
1312
+ Name:
1313
+ Symbol:
1314
+ to_s: b
1315
+ size: 1
1316
+ encoding: !ruby/encoding US-ASCII
1317
+ Value:
1318
+ MyStruct_1:
1319
+ size: 2
1320
+ Member 0:
1321
+ Name:
1322
+ Symbol:
1323
+ to_s: c
1324
+ size: 1
1325
+ encoding: !ruby/encoding US-ASCII
1326
+ Value: Fixnum 4
1327
+ Member 1:
1328
+ Name:
1329
+ Symbol:
1330
+ to_s: d
1331
+ size: 1
1332
+ encoding: !ruby/encoding US-ASCII
1333
+ Value: Fixnum 5
1334
+ ```
1335
+
1336
+ #### Circular Structs
1337
+
1338
+ This example shows structs that make a circular reference.
1339
+
1340
+ ```show.rb```:
1341
+ ```ruby
1342
+ require 'debug_helper'
1343
+
1344
+ MyStruct = Struct.new(:a, :b, :c)
1345
+ struct_0 = MyStruct.new(0, 1, 2)
1346
+ struct_1 = MyStruct.new(3, 4, 5)
1347
+ struct_0.a = struct_1
1348
+ struct_1.a = struct_0
1349
+ DebugHelper.show(struct_0, 'My circular struct')
1350
+ ```
1351
+
1352
+ The output shows details of the structs.
1353
+
1354
+ The circular reference is not followed.
1355
+
1356
+ ```show.yaml```:
1357
+ ```yaml
1358
+ ---
1359
+ MyStruct (message='My circular struct'):
1360
+ size: 3
1361
+ Member 0:
1362
+ Name:
1363
+ Symbol:
1364
+ to_s: a
1365
+ size: 1
1366
+ encoding: !ruby/encoding US-ASCII
1367
+ Value:
1368
+ MyStruct:
1369
+ size: 3
1370
+ Member 0:
1371
+ Name:
1372
+ Symbol:
1373
+ to_s: a
1374
+ size: 1
1375
+ encoding: !ruby/encoding US-ASCII
1376
+ Value: 'MyStruct #<struct MyStruct a=#<struct MyStruct a=#<struct MyStruct:...>,
1377
+ b=4, c=5>, b=1, c=2>'
1378
+ Member 1:
1379
+ Name:
1380
+ Symbol:
1381
+ to_s: b
1382
+ size: 1
1383
+ encoding: !ruby/encoding US-ASCII
1384
+ Value: Fixnum 4
1385
+ Member 2:
1386
+ Name:
1387
+ Symbol:
1388
+ to_s: c
1389
+ size: 1
1390
+ encoding: !ruby/encoding US-ASCII
1391
+ Value: Fixnum 5
1392
+ Member 1:
1393
+ Name:
1394
+ Symbol:
1395
+ to_s: b
1396
+ size: 1
1397
+ encoding: !ruby/encoding US-ASCII
1398
+ Value: Fixnum 1
1399
+ Member 2:
1400
+ Name:
1401
+ Symbol:
1402
+ to_s: c
1403
+ size: 1
1404
+ encoding: !ruby/encoding US-ASCII
1405
+ Value: Fixnum 2
1406
+ ```
1407
+ ### Symbol
1408
+
1409
+ #### Simple Symbol
1410
+
1411
+ This example shows a simple symbol.
1412
+
1413
+ ```show.rb```:
1414
+ ```ruby
1415
+ require 'debug_helper'
1416
+
1417
+ DebugHelper.show(:lorem_ipsum, 'My symbol')
1418
+ ```
1419
+
1420
+ The output shows details of the symbol.
1421
+
1422
+ ```show.yaml```:
1423
+ ```yaml
1424
+ ---
1425
+ Symbol (message='My symbol'):
1426
+ to_s: lorem_ipsum
1427
+ size: 11
1428
+ encoding: !ruby/encoding US-ASCII
1429
+ ```
1430
+ ### Object
1431
+
1432
+ Classes not mentioned above are not analyzed, but are treated more simply.
1433
+
1434
+ #### Unanalyzed Object
1435
+
1436
+ This example shows an object that will not be analyzed.
1437
+
1438
+ ```show.rb```:
1439
+ ```ruby
1440
+ require 'debug_helper'
1441
+
1442
+ class MyClass
1443
+ def inspect
1444
+ 'My class inspection'
1445
+ end
1446
+ end
1447
+ DebugHelper.show(MyClass.new, 'My class')
833
1448
  ```
834
1449
 
835
- The output shows details of the regexp.
1450
+ The output shows details of the object.
836
1451
 
837
1452
  ```show.yaml```:
838
1453
  ```yaml
839
- --- Regexp (message='My regexp') /foo/
1454
+ --- MyClass (message='My class') My class inspection
840
1455
  ...
841
1456
  ```
842
1457
 
@@ -870,52 +1485,67 @@ The output shows output for various depths.
870
1485
  ```show.yaml```:
871
1486
  ```yaml
872
1487
  ---
873
- Array (message='Show depth 1' size=2):
1488
+ Array (message='Show depth 1'):
1489
+ size: 2
874
1490
  Element 0: Fixnum 0
875
1491
  Element 1: Array [1, [2, [3, [4]]]]
876
1492
  ---
877
- Array (message='Show depth 2' size=2):
1493
+ Array (message='Show depth 2'):
1494
+ size: 2
878
1495
  Element 0: Fixnum 0
879
1496
  Element 1:
880
- Array (size=2):
1497
+ Array:
1498
+ size: 2
881
1499
  Element 0: Fixnum 1
882
1500
  Element 1: Array [2, [3, [4]]]
883
1501
  ---
884
- Array (message='Show depth 3' size=2):
1502
+ Array (message='Show depth 3'):
1503
+ size: 2
885
1504
  Element 0: Fixnum 0
886
1505
  Element 1:
887
- Array (size=2):
1506
+ Array:
1507
+ size: 2
888
1508
  Element 0: Fixnum 1
889
1509
  Element 1:
890
- Array (size=2):
1510
+ Array:
1511
+ size: 2
891
1512
  Element 0: Fixnum 2
892
1513
  Element 1: Array [3, [4]]
893
1514
  ---
894
- Array (message='Show depth 4' size=2):
1515
+ Array (message='Show depth 4'):
1516
+ size: 2
895
1517
  Element 0: Fixnum 0
896
1518
  Element 1:
897
- Array (size=2):
1519
+ Array:
1520
+ size: 2
898
1521
  Element 0: Fixnum 1
899
1522
  Element 1:
900
- Array (size=2):
1523
+ Array:
1524
+ size: 2
901
1525
  Element 0: Fixnum 2
902
1526
  Element 1:
903
- Array (size=2):
1527
+ Array:
1528
+ size: 2
904
1529
  Element 0: Fixnum 3
905
1530
  Element 1: Array [4]
906
1531
  ---
907
- Array (message='Show depth 5' size=2):
1532
+ Array (message='Show depth 5'):
1533
+ size: 2
908
1534
  Element 0: Fixnum 0
909
1535
  Element 1:
910
- Array (size=2):
1536
+ Array:
1537
+ size: 2
911
1538
  Element 0: Fixnum 1
912
1539
  Element 1:
913
- Array (size=2):
1540
+ Array:
1541
+ size: 2
914
1542
  Element 0: Fixnum 2
915
1543
  Element 1:
916
- Array (size=2):
1544
+ Array:
1545
+ size: 2
917
1546
  Element 0: Fixnum 3
918
1547
  Element 1:
919
- Array (size=1):
1548
+ Array:
1549
+ size: 1
920
1550
  Element 0: Fixnum 4
921
1551
  ```