debug_helper 1.8.0 → 2.0.0

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.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +572 -314
  4. data/bin/console +14 -14
  5. data/lib/debug_helper/handler.rb +8 -2
  6. data/lib/debug_helper/version.rb +1 -1
  7. data/markdown/readme/Rakefile +2 -1
  8. data/markdown/readme/class_inclusions.md +1 -0
  9. data/markdown/readme/classes/array/circular/show.md +2 -2
  10. data/markdown/readme/classes/array/circular/show.yaml +2 -2
  11. data/markdown/readme/classes/array/mixed/show.md +9 -9
  12. data/markdown/readme/classes/array/mixed/show.yaml +9 -9
  13. data/markdown/readme/classes/array/nested/show.md +3 -3
  14. data/markdown/readme/classes/array/nested/show.yaml +3 -3
  15. data/markdown/readme/classes/array/simple/show.md +1 -1
  16. data/markdown/readme/classes/array/simple/show.yaml +1 -1
  17. data/markdown/readme/classes/custom/both/foo.rb +21 -0
  18. data/markdown/readme/classes/custom/both/foo_handler.rb +27 -0
  19. data/markdown/readme/classes/custom/both/show.md +100 -0
  20. data/markdown/readme/classes/custom/both/show.rb +5 -0
  21. data/markdown/readme/classes/custom/both/show.yaml +20 -0
  22. data/markdown/readme/classes/custom/both/template.md +19 -0
  23. data/markdown/readme/classes/custom/instance/foo.rb +13 -0
  24. data/markdown/readme/classes/custom/instance/foo_handler.rb +18 -0
  25. data/markdown/readme/classes/custom/instance/show.md +74 -0
  26. data/markdown/readme/classes/custom/instance/show.rb +5 -0
  27. data/markdown/readme/classes/custom/instance/show.yaml +11 -0
  28. data/markdown/readme/classes/custom/instance/template.md +19 -0
  29. data/markdown/readme/classes/custom/singleton/foo.rb +13 -0
  30. data/markdown/readme/classes/custom/singleton/foo_handler.rb +18 -0
  31. data/markdown/readme/classes/custom/singleton/show.md +74 -0
  32. data/markdown/readme/classes/custom/singleton/show.rb +5 -0
  33. data/markdown/readme/classes/custom/singleton/show.yaml +11 -0
  34. data/markdown/readme/classes/custom/singleton/template.md +19 -0
  35. data/markdown/readme/classes/custom/template.md +10 -0
  36. data/markdown/readme/classes/dir/simple/show.md +3 -3
  37. data/markdown/readme/classes/dir/simple/show.yaml +3 -3
  38. data/markdown/readme/classes/exception/simple/show.md +3 -3
  39. data/markdown/readme/classes/exception/simple/show.yaml +3 -3
  40. data/markdown/readme/classes/file/simple/show.md +17 -17
  41. data/markdown/readme/classes/file/simple/show.yaml +17 -17
  42. data/markdown/readme/classes/hash/circular/show.md +12 -12
  43. data/markdown/readme/classes/hash/circular/show.yaml +12 -12
  44. data/markdown/readme/classes/hash/mixed/show.md +20 -20
  45. data/markdown/readme/classes/hash/mixed/show.yaml +20 -20
  46. data/markdown/readme/classes/hash/nested/show.md +27 -27
  47. data/markdown/readme/classes/hash/nested/show.yaml +27 -27
  48. data/markdown/readme/classes/hash/simple/show.md +12 -12
  49. data/markdown/readme/classes/hash/simple/show.yaml +12 -12
  50. data/markdown/readme/classes/io/simple/show.md +4 -4
  51. data/markdown/readme/classes/io/simple/show.yaml +4 -4
  52. data/markdown/readme/classes/match_data/multiple_captures/show.md +5 -5
  53. data/markdown/readme/classes/match_data/multiple_captures/show.yaml +5 -5
  54. data/markdown/readme/classes/match_data/named_captures/show.md +5 -5
  55. data/markdown/readme/classes/match_data/named_captures/show.yaml +5 -5
  56. data/markdown/readme/classes/match_data/simple/show.md +5 -5
  57. data/markdown/readme/classes/match_data/simple/show.yaml +5 -5
  58. data/markdown/readme/classes/open_struct/circular/show.md +6 -6
  59. data/markdown/readme/classes/open_struct/circular/show.yaml +6 -6
  60. data/markdown/readme/classes/open_struct/mixed/show.md +17 -17
  61. data/markdown/readme/classes/open_struct/mixed/show.yaml +17 -17
  62. data/markdown/readme/classes/open_struct/nested/show.md +18 -18
  63. data/markdown/readme/classes/open_struct/nested/show.yaml +18 -18
  64. data/markdown/readme/classes/open_struct/simple/show.md +9 -9
  65. data/markdown/readme/classes/open_struct/simple/show.yaml +9 -9
  66. data/markdown/readme/classes/range/exclude_end/show.md +3 -3
  67. data/markdown/readme/classes/range/exclude_end/show.yaml +3 -3
  68. data/markdown/readme/classes/range/include_end/show.md +3 -3
  69. data/markdown/readme/classes/range/include_end/show.yaml +3 -3
  70. data/markdown/readme/classes/regexp/named_captures/show.md +5 -5
  71. data/markdown/readme/classes/regexp/named_captures/show.yaml +5 -5
  72. data/markdown/readme/classes/regexp/simple/show.md +5 -5
  73. data/markdown/readme/classes/regexp/simple/show.yaml +5 -5
  74. data/markdown/readme/classes/set/circular/show.md +2 -2
  75. data/markdown/readme/classes/set/circular/show.yaml +2 -2
  76. data/markdown/readme/classes/set/mixed/show.md +9 -9
  77. data/markdown/readme/classes/set/mixed/show.yaml +9 -9
  78. data/markdown/readme/classes/set/nested/show.md +3 -3
  79. data/markdown/readme/classes/set/nested/show.yaml +3 -3
  80. data/markdown/readme/classes/set/simple/show.md +1 -1
  81. data/markdown/readme/classes/set/simple/show.yaml +1 -1
  82. data/markdown/readme/classes/string/multiline/show.md +5 -5
  83. data/markdown/readme/classes/string/multiline/show.yaml +5 -5
  84. data/markdown/readme/classes/string/simple/show.md +5 -5
  85. data/markdown/readme/classes/string/simple/show.yaml +5 -5
  86. data/markdown/readme/classes/struct/circular/show.md +20 -20
  87. data/markdown/readme/classes/struct/circular/show.yaml +20 -20
  88. data/markdown/readme/classes/struct/mixed/show.md +18 -18
  89. data/markdown/readme/classes/struct/mixed/show.yaml +18 -18
  90. data/markdown/readme/classes/struct/nested/show.md +21 -21
  91. data/markdown/readme/classes/struct/nested/show.yaml +21 -21
  92. data/markdown/readme/classes/struct/simple/show.md +10 -10
  93. data/markdown/readme/classes/struct/simple/show.yaml +10 -10
  94. data/markdown/readme/classes/symbol/simple/show.md +3 -3
  95. data/markdown/readme/classes/symbol/simple/show.yaml +3 -3
  96. data/markdown/readme/options/depth/show.md +15 -15
  97. data/markdown/readme/options/depth/show.yaml +15 -15
  98. data/markdown/readme/template.md +11 -8
  99. metadata +21 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b96c161aefd3636445bc0a68e63f815057037060
4
- data.tar.gz: 9c6de8c9b4f3d358d404a60437a5a4ccbda7894e
3
+ metadata.gz: 51525f61840672b3952396ecdd6c3ae0fa3d295d
4
+ data.tar.gz: df5651cf40374d2c92997bf35405ba547cf4c949
5
5
  SHA512:
6
- metadata.gz: dd4ff02ad1a77f4c2163cabd5d02c6cee83d6570e2ae2ef33bb674ac984a94ccf994f4307ddc1762df288edcae77aa0543e21b437e4e55a50bcc36f9438fbc70
7
- data.tar.gz: bdca4596038096b29f17a7e82c4f4488af737f50c23a50f3d7ae20ab7d2cfc84c2f708cd660c66b12bbdba0fa2eacbac28c20ebafbe9d24f2c7442386031107b
6
+ metadata.gz: 08d951eb328c33275490c86acf4f3332ca4e71c456a60d52ad5b0abc34804d8bb17258ef0207e05d0b5cdd0f88a5970263ba32e8c993f602f4cdb6a99b3fb7cf
7
+ data.tar.gz: dfea562f5ccbb2025430df32ac098bac73b231af0a59324fb51165a0a01d106776283a850e0689a5ffd82fc2679803b85279ef2c2db7596b346bd3674666ce1e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- debug_helper (1.8.0)
4
+ debug_helper (2.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,15 +1,14 @@
1
1
  # Debug Helper
2
2
 
3
- ## New in Version 1.8
3
+ [![Gem](https://img.shields.io/gem/v/debug_helper.svg?style=flat)](http://rubygems.org/gems/debug_helper "View this project in Rubygems")
4
4
 
5
- Classes analyzed:
5
+ ## New in Version 2.0
6
6
 
7
- - [Dir](#dir)
8
- - [Exception](#exception)
9
- - [Range](#range)
10
- - [Regexp](#regexp)
11
- - [IO](#io)
12
- - [MatchData](#matchdata)
7
+ Previously, ```debug_helper``` explicated objects for only certain classes in the Ruby core and standard library.
8
+
9
+ This version supports custom explication of user-defined classes. This means, in effect, that you can use ```debug_helper``` to explicate any classes you choose.
10
+
11
+ See [Custom](#custom).
13
12
 
14
13
  ## About Debug Helper
15
14
 
@@ -60,6 +59,10 @@ Others are treated as:
60
59
 
61
60
  - [Object](#object)
62
61
 
62
+ But wait, there's more! For your own classes, you can create your own handlers:
63
+
64
+ - [Custom](#custom)
65
+
63
66
  ## Class Method or Module Method?
64
67
 
65
68
  Most examples in this documentation show use of the class method:
@@ -99,7 +102,7 @@ The output shows details of the array.
99
102
  ```yaml
100
103
  ---
101
104
  Array (message='My simple array'):
102
- size: 3
105
+ Array#size: 3
103
106
  Element 0: Fixnum 5
104
107
  Element 1: Fixnum 10
105
108
  Element 2: Fixnum 15
@@ -123,20 +126,20 @@ The output shows details of the array.
123
126
  ```yaml
124
127
  ---
125
128
  Array (message='My mixed array'):
126
- size: 3
129
+ Array#size: 3
127
130
  Element 0: Fixnum 0
128
131
  Element 1:
129
132
  String:
130
- to_s: one
131
- size: 3
132
- encoding: !ruby/encoding UTF-8
133
- ascii_only?: true
134
- bytesize: 3
133
+ String#to_s: one
134
+ String#size: 3
135
+ String#encoding: !ruby/encoding UTF-8
136
+ String#ascii_only?: true
137
+ String#bytesize: 3
135
138
  Element 2:
136
139
  Symbol:
137
- to_s: two
138
- size: 3
139
- encoding: !ruby/encoding US-ASCII
140
+ Symbol#to_s: two
141
+ Symbol#size: 3
142
+ Symbol#encoding: !ruby/encoding US-ASCII
140
143
  ```
141
144
 
142
145
  #### Nested Arrays
@@ -157,16 +160,16 @@ The output shows details of the arrays.
157
160
  ```yaml
158
161
  ---
159
162
  Array (message='My nested arrays'):
160
- size: 3
163
+ Array#size: 3
161
164
  Element 0: Fixnum 0
162
165
  Element 1:
163
166
  Array:
164
- size: 2
167
+ Array#size: 2
165
168
  Element 0: Fixnum 1
166
169
  Element 1: Fixnum 2
167
170
  Element 2:
168
171
  Array:
169
- size: 2
172
+ Array#size: 2
170
173
  Element 0: Fixnum 3
171
174
  Element 1: Fixnum 4
172
175
  ```
@@ -194,10 +197,10 @@ The circular reference is not followed.
194
197
  ```yaml
195
198
  ---
196
199
  Array (message='My circular arrays'):
197
- size: 1
200
+ Array#size: 1
198
201
  Element 0:
199
202
  Array:
200
- size: 1
203
+ Array#size: 1
201
204
  Element 0: Array [[[...]]]
202
205
  ```
203
206
  ### Dir
@@ -220,15 +223,15 @@ The output shows details of the ```Dir```.
220
223
  ```yaml
221
224
  ---
222
225
  Dir (message='My simple dir'):
223
- path: "."
224
- entries:
226
+ Dir#path: "."
227
+ Dir.entries("."):
225
228
  - "."
226
229
  - ".."
227
230
  - show.md
228
231
  - show.rb
229
232
  - show.yaml
230
233
  - template.md
231
- exist?: true
234
+ Dir.exist?("."): true
232
235
  ```
233
236
  ### Exception
234
237
 
@@ -268,9 +271,9 @@ The output shows details of the ```Exception```.
268
271
  ```yaml
269
272
  ---
270
273
  Exception (message='My simple exception'):
271
- message: Boo!
272
- cause:
273
- backtrace:
274
+ Exception#message: Boo!
275
+ Exception#cause:
276
+ Exception#backtrace:
274
277
  - show.rb:6:in `foo'
275
278
  - show.rb:14:in `bar'
276
279
  - show.rb:18:in `baz'
@@ -296,23 +299,23 @@ The output shows details of the file.
296
299
  ```yaml
297
300
  ---
298
301
  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
302
+ File.absolute_path("show.rb"): C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
303
+ File.atime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
304
+ File.ctime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
305
+ File.executable?("show.rb"): false
306
+ File.exist?("show.rb"): true
307
+ File.ftype("show.rb"): file
308
+ File.mtime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
309
+ File.path("show.rb"): show.rb
310
+ File.pipe?("show.rb"): false
311
+ File.readable?("show.rb"): true
312
+ File.realpath("show.rb"): C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
313
+ File.setgid?("show.rb"): false
314
+ File.setuid?("show.rb"): false
315
+ File.size("show.rb"): 95
316
+ File.socket?("show.rb"): false
317
+ File.symlink?("show.rb"): false
318
+ File.writable?("show.rb"): true
316
319
  ```
317
320
  ### Hash
318
321
 
@@ -334,29 +337,29 @@ The output shows details of the hash.
334
337
  ```yaml
335
338
  ---
336
339
  Hash (message='My simple hash'):
337
- size: 3
338
- default:
339
- default_proc:
340
+ Hash#size: 3
341
+ Hash#default:
342
+ Hash#default_proc:
340
343
  Pair 0:
341
344
  Key:
342
345
  Symbol:
343
- to_s: a
344
- size: 1
345
- encoding: !ruby/encoding US-ASCII
346
+ Symbol#to_s: a
347
+ Symbol#size: 1
348
+ Symbol#encoding: !ruby/encoding US-ASCII
346
349
  Value: Fixnum 0
347
350
  Pair 1:
348
351
  Key:
349
352
  Symbol:
350
- to_s: b
351
- size: 1
352
- encoding: !ruby/encoding US-ASCII
353
+ Symbol#to_s: b
354
+ Symbol#size: 1
355
+ Symbol#encoding: !ruby/encoding US-ASCII
353
356
  Value: Fixnum 1
354
357
  Pair 2:
355
358
  Key:
356
359
  Symbol:
357
- to_s: c
358
- size: 1
359
- encoding: !ruby/encoding US-ASCII
360
+ Symbol#to_s: c
361
+ Symbol#size: 1
362
+ Symbol#encoding: !ruby/encoding US-ASCII
360
363
  Value: Fixnum 2
361
364
  ```
362
365
 
@@ -382,40 +385,40 @@ The output shows details of the hash.
382
385
  ```yaml
383
386
  ---
384
387
  Hash (message='My mixed hash'):
385
- size: 3
386
- default:
387
- default_proc:
388
+ Hash#size: 3
389
+ Hash#default:
390
+ Hash#default_proc:
388
391
  Pair 0:
389
392
  Key:
390
393
  Symbol:
391
- to_s: a
392
- size: 1
393
- encoding: !ruby/encoding US-ASCII
394
+ Symbol#to_s: a
395
+ Symbol#size: 1
396
+ Symbol#encoding: !ruby/encoding US-ASCII
394
397
  Value: Fixnum 0
395
398
  Pair 1:
396
399
  Key:
397
400
  Symbol:
398
- to_s: b
399
- size: 1
400
- encoding: !ruby/encoding US-ASCII
401
+ Symbol#to_s: b
402
+ Symbol#size: 1
403
+ Symbol#encoding: !ruby/encoding US-ASCII
401
404
  Value:
402
405
  String:
403
- to_s: one
404
- size: 3
405
- encoding: !ruby/encoding UTF-8
406
- ascii_only?: true
407
- bytesize: 3
406
+ String#to_s: one
407
+ String#size: 3
408
+ String#encoding: !ruby/encoding UTF-8
409
+ String#ascii_only?: true
410
+ String#bytesize: 3
408
411
  Pair 2:
409
412
  Key:
410
413
  Symbol:
411
- to_s: c
412
- size: 1
413
- encoding: !ruby/encoding US-ASCII
414
+ Symbol#to_s: c
415
+ Symbol#size: 1
416
+ Symbol#encoding: !ruby/encoding US-ASCII
414
417
  Value:
415
418
  Symbol:
416
- to_s: two
417
- size: 3
418
- encoding: !ruby/encoding US-ASCII
419
+ Symbol#to_s: two
420
+ Symbol#size: 3
421
+ Symbol#encoding: !ruby/encoding US-ASCII
419
422
  ```
420
423
 
421
424
  #### Nested Hashes
@@ -445,58 +448,58 @@ The output shows details of the hashes.
445
448
  ```yaml
446
449
  ---
447
450
  Hash (message='My nested hash'):
448
- size: 2
449
- default:
450
- default_proc:
451
+ Hash#size: 2
452
+ Hash#default:
453
+ Hash#default_proc:
451
454
  Pair 0:
452
455
  Key:
453
456
  Symbol:
454
- to_s: a
455
- size: 1
456
- encoding: !ruby/encoding US-ASCII
457
+ Symbol#to_s: a
458
+ Symbol#size: 1
459
+ Symbol#encoding: !ruby/encoding US-ASCII
457
460
  Value:
458
461
  Hash:
459
- size: 2
460
- default:
461
- default_proc:
462
+ Hash#size: 2
463
+ Hash#default:
464
+ Hash#default_proc:
462
465
  Pair 0:
463
466
  Key:
464
467
  Symbol:
465
- to_s: b
466
- size: 1
467
- encoding: !ruby/encoding US-ASCII
468
+ Symbol#to_s: b
469
+ Symbol#size: 1
470
+ Symbol#encoding: !ruby/encoding US-ASCII
468
471
  Value: Fixnum 0
469
472
  Pair 1:
470
473
  Key:
471
474
  Symbol:
472
- to_s: c
473
- size: 1
474
- encoding: !ruby/encoding US-ASCII
475
+ Symbol#to_s: c
476
+ Symbol#size: 1
477
+ Symbol#encoding: !ruby/encoding US-ASCII
475
478
  Value: Fixnum 1
476
479
  Pair 1:
477
480
  Key:
478
481
  Symbol:
479
- to_s: d
480
- size: 1
481
- encoding: !ruby/encoding US-ASCII
482
+ Symbol#to_s: d
483
+ Symbol#size: 1
484
+ Symbol#encoding: !ruby/encoding US-ASCII
482
485
  Value:
483
486
  Hash:
484
- size: 2
485
- default:
486
- default_proc:
487
+ Hash#size: 2
488
+ Hash#default:
489
+ Hash#default_proc:
487
490
  Pair 0:
488
491
  Key:
489
492
  Symbol:
490
- to_s: e
491
- size: 1
492
- encoding: !ruby/encoding US-ASCII
493
+ Symbol#to_s: e
494
+ Symbol#size: 1
495
+ Symbol#encoding: !ruby/encoding US-ASCII
493
496
  Value: Fixnum 2
494
497
  Pair 1:
495
498
  Key:
496
499
  Symbol:
497
- to_s: f
498
- size: 1
499
- encoding: !ruby/encoding US-ASCII
500
+ Symbol#to_s: f
501
+ Symbol#size: 1
502
+ Symbol#encoding: !ruby/encoding US-ASCII
500
503
  Value: Fixnum 3
501
504
  ```
502
505
 
@@ -523,26 +526,26 @@ The circular reference is not followed.
523
526
  ```yaml
524
527
  ---
525
528
  Hash (message='My circular hashes'):
526
- size: 1
527
- default:
528
- default_proc:
529
+ Hash#size: 1
530
+ Hash#default:
531
+ Hash#default_proc:
529
532
  Pair 0:
530
533
  Key:
531
534
  Symbol:
532
- to_s: foo
533
- size: 3
534
- encoding: !ruby/encoding US-ASCII
535
+ Symbol#to_s: foo
536
+ Symbol#size: 3
537
+ Symbol#encoding: !ruby/encoding US-ASCII
535
538
  Value:
536
539
  Hash:
537
- size: 1
538
- default:
539
- default_proc:
540
+ Hash#size: 1
541
+ Hash#default:
542
+ Hash#default_proc:
540
543
  Pair 0:
541
544
  Key:
542
545
  Symbol:
543
- to_s: bar
544
- size: 3
545
- encoding: !ruby/encoding US-ASCII
546
+ Symbol#to_s: bar
547
+ Symbol#size: 3
548
+ Symbol#encoding: !ruby/encoding US-ASCII
546
549
  Value: Hash {:foo=>{:bar=>{...}}}
547
550
  ```
548
551
  ### IO
@@ -565,10 +568,10 @@ The output shows details of the ```IO```.
565
568
  ```yaml
566
569
  ---
567
570
  IO (message='My simple io'):
568
- autoclose?: true
569
- binmode?: false
570
- closed?: false
571
- tty?: false
571
+ IO#autoclose?: true
572
+ IO#binmode?: false
573
+ IO#closed?: false
574
+ IO#tty?: false
572
575
  ```
573
576
  ### MatchData
574
577
 
@@ -590,12 +593,12 @@ The output shows details of the ```MatchData```.
590
593
  ```yaml
591
594
  ---
592
595
  MatchData (message='My simple MatchData'):
593
- size: 1
594
- regexp: !ruby/regexp /[a-z]/
595
- to_a:
596
+ MatchData#size: 1
597
+ MatchData#regexp: !ruby/regexp /[a-z]/
598
+ MatchData#to_a:
596
599
  - a
597
- captures: []
598
- names: []
600
+ MatchData#captures: []
601
+ MatchData#names: []
599
602
  ```
600
603
 
601
604
  #### Multiple Captures
@@ -616,20 +619,20 @@ The output shows details of the ```MatchData```.
616
619
  ```yaml
617
620
  ---
618
621
  MatchData (message='My MatchData with named captures'):
619
- size: 5
620
- regexp: !ruby/regexp /(.)(.)(\d+)(\d)/
621
- to_a:
622
+ MatchData#size: 5
623
+ MatchData#regexp: !ruby/regexp /(.)(.)(\d+)(\d)/
624
+ MatchData#to_a:
622
625
  - HX1138
623
626
  - H
624
627
  - X
625
628
  - '113'
626
629
  - '8'
627
- captures:
630
+ MatchData#captures:
628
631
  - H
629
632
  - X
630
633
  - '113'
631
634
  - '8'
632
- names: []
635
+ MatchData#names: []
633
636
  ```
634
637
 
635
638
  #### Named Captures
@@ -650,16 +653,16 @@ The output shows details of the ```MatchData```.
650
653
  ```yaml
651
654
  ---
652
655
  MatchData (message='My MatchData with named captures'):
653
- size: 3
654
- regexp: !ruby/regexp /(?<x>.)(?<y>.)?/
655
- to_a:
656
+ MatchData#size: 3
657
+ MatchData#regexp: !ruby/regexp /(?<x>.)(?<y>.)?/
658
+ MatchData#to_a:
656
659
  - a
657
660
  - a
658
661
  -
659
- captures:
662
+ MatchData#captures:
660
663
  - a
661
664
  -
662
- names:
665
+ MatchData#names:
663
666
  - x
664
667
  - y
665
668
  ```
@@ -687,23 +690,23 @@ OpenStruct (message='My simple struct'):
687
690
  Member 0:
688
691
  Name:
689
692
  Symbol:
690
- to_s: a
691
- size: 1
692
- encoding: !ruby/encoding US-ASCII
693
+ Symbol#to_s: a
694
+ Symbol#size: 1
695
+ Symbol#encoding: !ruby/encoding US-ASCII
693
696
  Value: Fixnum 0
694
697
  Member 1:
695
698
  Name:
696
699
  Symbol:
697
- to_s: b
698
- size: 1
699
- encoding: !ruby/encoding US-ASCII
700
+ Symbol#to_s: b
701
+ Symbol#size: 1
702
+ Symbol#encoding: !ruby/encoding US-ASCII
700
703
  Value: Fixnum 1
701
704
  Member 2:
702
705
  Name:
703
706
  Symbol:
704
- to_s: c
705
- size: 1
706
- encoding: !ruby/encoding US-ASCII
707
+ Symbol#to_s: c
708
+ Symbol#size: 1
709
+ Symbol#encoding: !ruby/encoding US-ASCII
707
710
  Value: Fixnum 2
708
711
  ```
709
712
 
@@ -729,34 +732,34 @@ OpenStruct (message='My mixed open struct'):
729
732
  Member 0:
730
733
  Name:
731
734
  Symbol:
732
- to_s: a
733
- size: 1
734
- encoding: !ruby/encoding US-ASCII
735
+ Symbol#to_s: a
736
+ Symbol#size: 1
737
+ Symbol#encoding: !ruby/encoding US-ASCII
735
738
  Value: Fixnum 0
736
739
  Member 1:
737
740
  Name:
738
741
  Symbol:
739
- to_s: b
740
- size: 1
741
- encoding: !ruby/encoding US-ASCII
742
+ Symbol#to_s: b
743
+ Symbol#size: 1
744
+ Symbol#encoding: !ruby/encoding US-ASCII
742
745
  Value:
743
746
  String:
744
- to_s: one
745
- size: 3
746
- encoding: !ruby/encoding UTF-8
747
- ascii_only?: true
748
- bytesize: 3
747
+ String#to_s: one
748
+ String#size: 3
749
+ String#encoding: !ruby/encoding UTF-8
750
+ String#ascii_only?: true
751
+ String#bytesize: 3
749
752
  Member 2:
750
753
  Name:
751
754
  Symbol:
752
- to_s: c
753
- size: 1
754
- encoding: !ruby/encoding US-ASCII
755
+ Symbol#to_s: c
756
+ Symbol#size: 1
757
+ Symbol#encoding: !ruby/encoding US-ASCII
755
758
  Value:
756
759
  Symbol:
757
- to_s: two
758
- size: 3
759
- encoding: !ruby/encoding US-ASCII
760
+ Symbol#to_s: two
761
+ Symbol#size: 3
762
+ Symbol#encoding: !ruby/encoding US-ASCII
760
763
  ```
761
764
 
762
765
  #### Nested OpenStructs
@@ -790,46 +793,46 @@ OpenStruct (message='My nested struct'):
790
793
  Member 0:
791
794
  Name:
792
795
  Symbol:
793
- to_s: a
794
- size: 1
795
- encoding: !ruby/encoding US-ASCII
796
+ Symbol#to_s: a
797
+ Symbol#size: 1
798
+ Symbol#encoding: !ruby/encoding US-ASCII
796
799
  Value:
797
800
  OpenStruct:
798
801
  Member 0:
799
802
  Name:
800
803
  Symbol:
801
- to_s: b
802
- size: 1
803
- encoding: !ruby/encoding US-ASCII
804
+ Symbol#to_s: b
805
+ Symbol#size: 1
806
+ Symbol#encoding: !ruby/encoding US-ASCII
804
807
  Value: Fixnum 0
805
808
  Member 1:
806
809
  Name:
807
810
  Symbol:
808
- to_s: c
809
- size: 1
810
- encoding: !ruby/encoding US-ASCII
811
+ Symbol#to_s: c
812
+ Symbol#size: 1
813
+ Symbol#encoding: !ruby/encoding US-ASCII
811
814
  Value: Fixnum 1
812
815
  Member 1:
813
816
  Name:
814
817
  Symbol:
815
- to_s: d
816
- size: 1
817
- encoding: !ruby/encoding US-ASCII
818
+ Symbol#to_s: d
819
+ Symbol#size: 1
820
+ Symbol#encoding: !ruby/encoding US-ASCII
818
821
  Value:
819
822
  OpenStruct:
820
823
  Member 0:
821
824
  Name:
822
825
  Symbol:
823
- to_s: e
824
- size: 1
825
- encoding: !ruby/encoding US-ASCII
826
+ Symbol#to_s: e
827
+ Symbol#size: 1
828
+ Symbol#encoding: !ruby/encoding US-ASCII
826
829
  Value: Fixnum 2
827
830
  Member 1:
828
831
  Name:
829
832
  Symbol:
830
- to_s: f
831
- size: 1
832
- encoding: !ruby/encoding US-ASCII
833
+ Symbol#to_s: f
834
+ Symbol#size: 1
835
+ Symbol#encoding: !ruby/encoding US-ASCII
833
836
  Value: Fixnum 3
834
837
  ```
835
838
 
@@ -860,17 +863,17 @@ OpenStruct (message='My circular ostruct'):
860
863
  Member 0:
861
864
  Name:
862
865
  Symbol:
863
- to_s: a
864
- size: 1
865
- encoding: !ruby/encoding US-ASCII
866
+ Symbol#to_s: a
867
+ Symbol#size: 1
868
+ Symbol#encoding: !ruby/encoding US-ASCII
866
869
  Value:
867
870
  OpenStruct:
868
871
  Member 0:
869
872
  Name:
870
873
  Symbol:
871
- to_s: a
872
- size: 1
873
- encoding: !ruby/encoding US-ASCII
874
+ Symbol#to_s: a
875
+ Symbol#size: 1
876
+ Symbol#encoding: !ruby/encoding US-ASCII
874
877
  Value: 'OpenStruct #<OpenStruct a=#<OpenStruct a=#<OpenStruct ...>>>'
875
878
  ```
876
879
  ### Range
@@ -893,9 +896,9 @@ The output shows details of the ```Range```.
893
896
  ```yaml
894
897
  ---
895
898
  Range (message='My inclusive range'):
896
- first: 0
897
- last: 4
898
- exclude_end?: false
899
+ Range#first: 0
900
+ Range#last: 4
901
+ Range#exclude_end?: false
899
902
  ```
900
903
 
901
904
  #### Exclusive Range
@@ -916,9 +919,9 @@ The output shows details of the ```Range```.
916
919
  ```yaml
917
920
  ---
918
921
  Range (message='My exclusive range'):
919
- first: 0
920
- last: 4
921
- exclude_end?: true
922
+ Range#first: 0
923
+ Range#last: 4
924
+ Range#exclude_end?: true
922
925
  ```
923
926
  ### Regexp
924
927
 
@@ -940,11 +943,11 @@ The output shows details of the ```Regexp```.
940
943
  ```yaml
941
944
  ---
942
945
  Regexp (message='My simple regexp'):
943
- to_s: "(?-mix:\\w+)"
944
- casefold?: false
945
- named_captures: {}
946
- encoding: !ruby/encoding US-ASCII
947
- fixed_encoding?: false
946
+ Regexp#to_s: "(?-mix:\\w+)"
947
+ Regexp#casefold?: false
948
+ Regexp#named_captures: {}
949
+ Regexp#encoding: !ruby/encoding US-ASCII
950
+ Regexp#fixed_encoding?: false
948
951
  ```
949
952
 
950
953
  #### Named Captures
@@ -965,15 +968,15 @@ The output shows details of the ```Regexp```.
965
968
  ```yaml
966
969
  ---
967
970
  Regexp (message='My regexp with named captures'):
968
- to_s: "(?-mix:(?<a>.)(?<b>.))"
969
- casefold?: false
970
- named_captures:
971
+ Regexp#to_s: "(?-mix:(?<a>.)(?<b>.))"
972
+ Regexp#casefold?: false
973
+ Regexp#named_captures:
971
974
  a:
972
975
  - 1
973
976
  b:
974
977
  - 2
975
- encoding: !ruby/encoding US-ASCII
976
- fixed_encoding?: false
978
+ Regexp#encoding: !ruby/encoding US-ASCII
979
+ Regexp#fixed_encoding?: false
977
980
  ```
978
981
  ### Set
979
982
 
@@ -997,7 +1000,7 @@ The output shows details of the set.
997
1000
  ```yaml
998
1001
  ---
999
1002
  Set (message='My simple set'):
1000
- size: 3
1003
+ Set#size: 3
1001
1004
  Element 0: Fixnum 5
1002
1005
  Element 1: Fixnum 10
1003
1006
  Element 2: Fixnum 15
@@ -1023,20 +1026,20 @@ The output shows details of the set.
1023
1026
  ```yaml
1024
1027
  ---
1025
1028
  Set (message='My mixed set'):
1026
- size: 3
1029
+ Set#size: 3
1027
1030
  Element 0: Fixnum 0
1028
1031
  Element 1:
1029
1032
  String:
1030
- to_s: one
1031
- size: 3
1032
- encoding: !ruby/encoding UTF-8
1033
- ascii_only?: true
1034
- bytesize: 3
1033
+ String#to_s: one
1034
+ String#size: 3
1035
+ String#encoding: !ruby/encoding UTF-8
1036
+ String#ascii_only?: true
1037
+ String#bytesize: 3
1035
1038
  Element 2:
1036
1039
  Symbol:
1037
- to_s: two
1038
- size: 3
1039
- encoding: !ruby/encoding US-ASCII
1040
+ Symbol#to_s: two
1041
+ Symbol#size: 3
1042
+ Symbol#encoding: !ruby/encoding US-ASCII
1040
1043
  ```
1041
1044
 
1042
1045
  #### Nested Sets
@@ -1063,16 +1066,16 @@ The output shows details of the sets.
1063
1066
  ```yaml
1064
1067
  ---
1065
1068
  Set (message='My nested sets'):
1066
- size: 3
1069
+ Set#size: 3
1067
1070
  Element 0: Fixnum 0
1068
1071
  Element 1:
1069
1072
  Set:
1070
- size: 2
1073
+ Set#size: 2
1071
1074
  Element 0: Fixnum 1
1072
1075
  Element 1: Fixnum 2
1073
1076
  Element 2:
1074
1077
  Set:
1075
- size: 2
1078
+ Set#size: 2
1076
1079
  Element 0: Fixnum 3
1077
1080
  Element 1: Fixnum 4
1078
1081
  ```
@@ -1102,10 +1105,10 @@ The circular reference is not followed.
1102
1105
  ```yaml
1103
1106
  ---
1104
1107
  Set (message='My circular sets'):
1105
- size: 1
1108
+ Set#size: 1
1106
1109
  Element 0:
1107
1110
  Set:
1108
- size: 1
1111
+ Set#size: 1
1109
1112
  Element 0: 'Set #<Set: {#<Set: {#<Set: {...}>}>}>'
1110
1113
  ```
1111
1114
  ### String
@@ -1128,11 +1131,11 @@ The output shows details of the string.
1128
1131
  ```yaml
1129
1132
  ---
1130
1133
  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
1134
+ String#to_s: Lorem ipsum
1135
+ String#size: 11
1136
+ String#encoding: !ruby/encoding UTF-8
1137
+ String#ascii_only?: true
1138
+ String#bytesize: 11
1136
1139
  ```
1137
1140
 
1138
1141
  #### Multiline String
@@ -1156,13 +1159,13 @@ The output shows details of the string.
1156
1159
  ```yaml
1157
1160
  ---
1158
1161
  String (message='My multiline string'):
1159
- to_s: |
1162
+ String#to_s: |
1160
1163
  Lorem Ipsum dolor sit amet,consectetur adipisicing elit,
1161
1164
  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
1165
+ String#size: 122
1166
+ String#encoding: !ruby/encoding UTF-8
1167
+ String#ascii_only?: true
1168
+ String#bytesize: 122
1166
1169
  ```
1167
1170
  ### Struct
1168
1171
 
@@ -1185,27 +1188,27 @@ The output shows details of the struct.
1185
1188
  ```yaml
1186
1189
  ---
1187
1190
  MyStruct (message='My simple struct'):
1188
- size: 3
1191
+ MyStruct#size: 3
1189
1192
  Member 0:
1190
1193
  Name:
1191
1194
  Symbol:
1192
- to_s: a
1193
- size: 1
1194
- encoding: !ruby/encoding US-ASCII
1195
+ Symbol#to_s: a
1196
+ Symbol#size: 1
1197
+ Symbol#encoding: !ruby/encoding US-ASCII
1195
1198
  Value: Fixnum 0
1196
1199
  Member 1:
1197
1200
  Name:
1198
1201
  Symbol:
1199
- to_s: b
1200
- size: 1
1201
- encoding: !ruby/encoding US-ASCII
1202
+ Symbol#to_s: b
1203
+ Symbol#size: 1
1204
+ Symbol#encoding: !ruby/encoding US-ASCII
1202
1205
  Value: Fixnum 1
1203
1206
  Member 2:
1204
1207
  Name:
1205
1208
  Symbol:
1206
- to_s: c
1207
- size: 1
1208
- encoding: !ruby/encoding US-ASCII
1209
+ Symbol#to_s: c
1210
+ Symbol#size: 1
1211
+ Symbol#encoding: !ruby/encoding US-ASCII
1209
1212
  Value: Fixnum 2
1210
1213
  ```
1211
1214
 
@@ -1228,38 +1231,38 @@ The output shows details of the struct.
1228
1231
  ```yaml
1229
1232
  ---
1230
1233
  MyStruct (message='My mixed struct'):
1231
- size: 3
1234
+ MyStruct#size: 3
1232
1235
  Member 0:
1233
1236
  Name:
1234
1237
  Symbol:
1235
- to_s: a
1236
- size: 1
1237
- encoding: !ruby/encoding US-ASCII
1238
+ Symbol#to_s: a
1239
+ Symbol#size: 1
1240
+ Symbol#encoding: !ruby/encoding US-ASCII
1238
1241
  Value: Fixnum 0
1239
1242
  Member 1:
1240
1243
  Name:
1241
1244
  Symbol:
1242
- to_s: b
1243
- size: 1
1244
- encoding: !ruby/encoding US-ASCII
1245
+ Symbol#to_s: b
1246
+ Symbol#size: 1
1247
+ Symbol#encoding: !ruby/encoding US-ASCII
1245
1248
  Value:
1246
1249
  String:
1247
- to_s: one
1248
- size: 3
1249
- encoding: !ruby/encoding UTF-8
1250
- ascii_only?: true
1251
- bytesize: 3
1250
+ String#to_s: one
1251
+ String#size: 3
1252
+ String#encoding: !ruby/encoding UTF-8
1253
+ String#ascii_only?: true
1254
+ String#bytesize: 3
1252
1255
  Member 2:
1253
1256
  Name:
1254
1257
  Symbol:
1255
- to_s: c
1256
- size: 1
1257
- encoding: !ruby/encoding US-ASCII
1258
+ Symbol#to_s: c
1259
+ Symbol#size: 1
1260
+ Symbol#encoding: !ruby/encoding US-ASCII
1258
1261
  Value:
1259
1262
  Symbol:
1260
- to_s: two
1261
- size: 3
1262
- encoding: !ruby/encoding US-ASCII
1263
+ Symbol#to_s: two
1264
+ Symbol#size: 3
1265
+ Symbol#encoding: !ruby/encoding US-ASCII
1263
1266
  ```
1264
1267
 
1265
1268
  #### Nested Structs
@@ -1284,52 +1287,52 @@ The output shows details of the structs.
1284
1287
  ```yaml
1285
1288
  ---
1286
1289
  MyStruct_0 (message='My nested struct'):
1287
- size: 2
1290
+ MyStruct_0#size: 2
1288
1291
  Member 0:
1289
1292
  Name:
1290
1293
  Symbol:
1291
- to_s: a
1292
- size: 1
1293
- encoding: !ruby/encoding US-ASCII
1294
+ Symbol#to_s: a
1295
+ Symbol#size: 1
1296
+ Symbol#encoding: !ruby/encoding US-ASCII
1294
1297
  Value:
1295
1298
  MyStruct_1:
1296
- size: 2
1299
+ MyStruct_1#size: 2
1297
1300
  Member 0:
1298
1301
  Name:
1299
1302
  Symbol:
1300
- to_s: c
1301
- size: 1
1302
- encoding: !ruby/encoding US-ASCII
1303
+ Symbol#to_s: c
1304
+ Symbol#size: 1
1305
+ Symbol#encoding: !ruby/encoding US-ASCII
1303
1306
  Value: Fixnum 2
1304
1307
  Member 1:
1305
1308
  Name:
1306
1309
  Symbol:
1307
- to_s: d
1308
- size: 1
1309
- encoding: !ruby/encoding US-ASCII
1310
+ Symbol#to_s: d
1311
+ Symbol#size: 1
1312
+ Symbol#encoding: !ruby/encoding US-ASCII
1310
1313
  Value: Fixnum 3
1311
1314
  Member 1:
1312
1315
  Name:
1313
1316
  Symbol:
1314
- to_s: b
1315
- size: 1
1316
- encoding: !ruby/encoding US-ASCII
1317
+ Symbol#to_s: b
1318
+ Symbol#size: 1
1319
+ Symbol#encoding: !ruby/encoding US-ASCII
1317
1320
  Value:
1318
1321
  MyStruct_1:
1319
- size: 2
1322
+ MyStruct_1#size: 2
1320
1323
  Member 0:
1321
1324
  Name:
1322
1325
  Symbol:
1323
- to_s: c
1324
- size: 1
1325
- encoding: !ruby/encoding US-ASCII
1326
+ Symbol#to_s: c
1327
+ Symbol#size: 1
1328
+ Symbol#encoding: !ruby/encoding US-ASCII
1326
1329
  Value: Fixnum 4
1327
1330
  Member 1:
1328
1331
  Name:
1329
1332
  Symbol:
1330
- to_s: d
1331
- size: 1
1332
- encoding: !ruby/encoding US-ASCII
1333
+ Symbol#to_s: d
1334
+ Symbol#size: 1
1335
+ Symbol#encoding: !ruby/encoding US-ASCII
1333
1336
  Value: Fixnum 5
1334
1337
  ```
1335
1338
 
@@ -1357,51 +1360,51 @@ The circular reference is not followed.
1357
1360
  ```yaml
1358
1361
  ---
1359
1362
  MyStruct (message='My circular struct'):
1360
- size: 3
1363
+ MyStruct#size: 3
1361
1364
  Member 0:
1362
1365
  Name:
1363
1366
  Symbol:
1364
- to_s: a
1365
- size: 1
1366
- encoding: !ruby/encoding US-ASCII
1367
+ Symbol#to_s: a
1368
+ Symbol#size: 1
1369
+ Symbol#encoding: !ruby/encoding US-ASCII
1367
1370
  Value:
1368
1371
  MyStruct:
1369
- size: 3
1372
+ MyStruct#size: 3
1370
1373
  Member 0:
1371
1374
  Name:
1372
1375
  Symbol:
1373
- to_s: a
1374
- size: 1
1375
- encoding: !ruby/encoding US-ASCII
1376
+ Symbol#to_s: a
1377
+ Symbol#size: 1
1378
+ Symbol#encoding: !ruby/encoding US-ASCII
1376
1379
  Value: 'MyStruct #<struct MyStruct a=#<struct MyStruct a=#<struct MyStruct:...>,
1377
1380
  b=4, c=5>, b=1, c=2>'
1378
1381
  Member 1:
1379
1382
  Name:
1380
1383
  Symbol:
1381
- to_s: b
1382
- size: 1
1383
- encoding: !ruby/encoding US-ASCII
1384
+ Symbol#to_s: b
1385
+ Symbol#size: 1
1386
+ Symbol#encoding: !ruby/encoding US-ASCII
1384
1387
  Value: Fixnum 4
1385
1388
  Member 2:
1386
1389
  Name:
1387
1390
  Symbol:
1388
- to_s: c
1389
- size: 1
1390
- encoding: !ruby/encoding US-ASCII
1391
+ Symbol#to_s: c
1392
+ Symbol#size: 1
1393
+ Symbol#encoding: !ruby/encoding US-ASCII
1391
1394
  Value: Fixnum 5
1392
1395
  Member 1:
1393
1396
  Name:
1394
1397
  Symbol:
1395
- to_s: b
1396
- size: 1
1397
- encoding: !ruby/encoding US-ASCII
1398
+ Symbol#to_s: b
1399
+ Symbol#size: 1
1400
+ Symbol#encoding: !ruby/encoding US-ASCII
1398
1401
  Value: Fixnum 1
1399
1402
  Member 2:
1400
1403
  Name:
1401
1404
  Symbol:
1402
- to_s: c
1403
- size: 1
1404
- encoding: !ruby/encoding US-ASCII
1405
+ Symbol#to_s: c
1406
+ Symbol#size: 1
1407
+ Symbol#encoding: !ruby/encoding US-ASCII
1405
1408
  Value: Fixnum 2
1406
1409
  ```
1407
1410
  ### Symbol
@@ -1423,9 +1426,9 @@ The output shows details of the symbol.
1423
1426
  ```yaml
1424
1427
  ---
1425
1428
  Symbol (message='My symbol'):
1426
- to_s: lorem_ipsum
1427
- size: 11
1428
- encoding: !ruby/encoding US-ASCII
1429
+ Symbol#to_s: lorem_ipsum
1430
+ Symbol#size: 11
1431
+ Symbol#encoding: !ruby/encoding US-ASCII
1429
1432
  ```
1430
1433
  ### Object
1431
1434
 
@@ -1454,6 +1457,261 @@ The output shows details of the object.
1454
1457
  --- MyClass (message='My class') My class inspection
1455
1458
  ...
1456
1459
  ```
1460
+ ### Custom
1461
+
1462
+ You can create custom handlers for your own classes.
1463
+
1464
+ #### Instance Methods
1465
+
1466
+ This example shows a custom handler that explicates via instance methods.
1467
+
1468
+ Here's a class ```Foo``` that has some instance methods:
1469
+
1470
+ ```foo.rb```:
1471
+ ```ruby
1472
+ require 'debug_helper'
1473
+
1474
+ class Foo
1475
+
1476
+ def my_array
1477
+ %w/foo bar baz/
1478
+ end
1479
+
1480
+ def my_hash
1481
+ {:a => 0, :b => 1}
1482
+ end
1483
+
1484
+ end
1485
+ ```
1486
+
1487
+ Here's its custom debug handler class ```FooHandler```. The array returned by method ```calls_for_instance``` tells the base class ```Handler``` which methods to call for the explication, and what arguments to pass, if any.
1488
+
1489
+ ```foo_handler.rb```:
1490
+ ```ruby
1491
+ require 'debug_helper'
1492
+
1493
+ class DebugHelper
1494
+
1495
+ class FooHandler < Handler
1496
+
1497
+ def calls_for_instance
1498
+ [
1499
+ [:my_array],
1500
+ [:my_hash],
1501
+ [:respond_to?, :your_array],
1502
+ [:respond_to?, :your_hash],
1503
+ ]
1504
+ end
1505
+
1506
+ end
1507
+
1508
+ end
1509
+ ```
1510
+
1511
+ Here's a program that uses the custom handler.
1512
+
1513
+ ```show.rb```:
1514
+ ```ruby
1515
+ require 'debug_helper'
1516
+ require_relative 'foo'
1517
+ require_relative 'foo_handler'
1518
+
1519
+ DebugHelper.show(Foo.new, 'My class Foo')
1520
+ ```
1521
+
1522
+ The output shows details of the object.
1523
+
1524
+ ```show.yaml```:
1525
+ ```yaml
1526
+ ---
1527
+ Foo (message='My class Foo'):
1528
+ Foo#my_array:
1529
+ - foo
1530
+ - bar
1531
+ - baz
1532
+ Foo#my_hash:
1533
+ :a: 0
1534
+ :b: 1
1535
+ Foo#respond_to?(:your_array): false
1536
+ Foo#respond_to?(:your_hash): false
1537
+ ```
1538
+
1539
+ #### Singleton Methods
1540
+
1541
+ This example shows a custom handler that explicates via singleton methods.
1542
+
1543
+ Here's a class ```Foo``` that has some singleton methods:
1544
+
1545
+ ```foo.rb```:
1546
+ ```ruby
1547
+ require 'debug_helper'
1548
+
1549
+ class Foo
1550
+
1551
+ def self.my_array
1552
+ %w/bat bam bad/
1553
+ end
1554
+
1555
+ def self.my_hash
1556
+ {:c => 2, :d => 3}
1557
+ end
1558
+
1559
+ end
1560
+ ```
1561
+
1562
+ Here's its custom debug handler class ```FooHandler```. The array returned in method ```calls_for_class``` tells the base class ```Handler``` which methods to call for the explication.
1563
+
1564
+ ```foo_handler.rb```:
1565
+ ```ruby
1566
+ require 'debug_helper'
1567
+
1568
+ class DebugHelper
1569
+
1570
+ class FooHandler < Handler
1571
+
1572
+ def calls_for_class
1573
+ [
1574
+ [:my_array],
1575
+ [:my_hash],
1576
+ [:respond_to?, :your_array],
1577
+ [:respond_to?, :your_hash],
1578
+ ]
1579
+ end
1580
+
1581
+ end
1582
+
1583
+ end
1584
+ ```
1585
+
1586
+ Here's a program that uses the custom handler.
1587
+
1588
+ ```show.rb```:
1589
+ ```ruby
1590
+ require 'debug_helper'
1591
+ require_relative 'foo'
1592
+ require_relative 'foo_handler'
1593
+
1594
+ DebugHelper.show(Foo.new, 'My class Foo')
1595
+ ```
1596
+
1597
+ The output shows details of the object.
1598
+
1599
+ ```show.yaml```:
1600
+ ```yaml
1601
+ ---
1602
+ Foo (message='My class Foo'):
1603
+ Foo.my_array:
1604
+ - bat
1605
+ - bam
1606
+ - bad
1607
+ Foo.my_hash:
1608
+ :c: 2
1609
+ :d: 3
1610
+ Foo.respond_to?(:your_array): false
1611
+ Foo.respond_to?(:your_hash): false
1612
+ ```
1613
+
1614
+ #### Instance and Singleton Methods
1615
+
1616
+ This example shows a custom handler that explicates via both kinds of methods.
1617
+
1618
+ Here's a class ```Foo``` that has instance methods and singleton methods:
1619
+
1620
+ ```foo.rb```:
1621
+ ```ruby
1622
+ require 'debug_helper'
1623
+
1624
+ class Foo
1625
+
1626
+ def my_array
1627
+ %w/foo bar baz/
1628
+ end
1629
+
1630
+ def my_hash
1631
+ {:a => 0, :b => 1}
1632
+ end
1633
+
1634
+ def self.my_array
1635
+ %w/bat bam bad/
1636
+ end
1637
+
1638
+ def self.my_hash
1639
+ {:c => 2, :d => 3}
1640
+ end
1641
+
1642
+ end
1643
+ ```
1644
+
1645
+ Here's its custom debug handler class ```FooHandler```.
1646
+
1647
+ ```foo_handler.rb```:
1648
+ ```ruby
1649
+ require 'debug_helper'
1650
+
1651
+ class DebugHelper
1652
+
1653
+ class FooHandler < Handler
1654
+
1655
+ def calls_for_instance
1656
+ [
1657
+ [:my_array],
1658
+ [:my_hash],
1659
+ [:respond_to?, :your_array],
1660
+ [:respond_to?, :your_hash],
1661
+ ]
1662
+ end
1663
+
1664
+ def calls_for_class
1665
+ [
1666
+ [:my_array],
1667
+ [:my_hash],
1668
+ [:respond_to?, :your_array],
1669
+ [:respond_to?, :your_hash],
1670
+ ]
1671
+ end
1672
+
1673
+ end
1674
+
1675
+ end
1676
+ ```
1677
+
1678
+ Here's a program that uses the custom handler.
1679
+
1680
+ ```show.rb```:
1681
+ ```ruby
1682
+ require 'debug_helper'
1683
+ require_relative 'foo'
1684
+ require_relative 'foo_handler'
1685
+
1686
+ DebugHelper.show(Foo.new, 'My class Foo')
1687
+ ```
1688
+
1689
+ The output shows details of the object.
1690
+
1691
+ ```show.yaml```:
1692
+ ```yaml
1693
+ ---
1694
+ Foo (message='My class Foo'):
1695
+ Foo#my_array:
1696
+ - foo
1697
+ - bar
1698
+ - baz
1699
+ Foo#my_hash:
1700
+ :a: 0
1701
+ :b: 1
1702
+ Foo#respond_to?(:your_array): false
1703
+ Foo#respond_to?(:your_hash): false
1704
+ Foo.my_array:
1705
+ - bat
1706
+ - bam
1707
+ - bad
1708
+ Foo.my_hash:
1709
+ :c: 2
1710
+ :d: 3
1711
+ Foo.respond_to?(:your_array): false
1712
+ Foo.respond_to?(:your_hash): false
1713
+ ```
1714
+
1457
1715
 
1458
1716
  ## Options
1459
1717
 
@@ -1486,66 +1744,66 @@ The output shows output for various depths.
1486
1744
  ```yaml
1487
1745
  ---
1488
1746
  Array (message='Show depth 1'):
1489
- size: 2
1747
+ Array#size: 2
1490
1748
  Element 0: Fixnum 0
1491
1749
  Element 1: Array [1, [2, [3, [4]]]]
1492
1750
  ---
1493
1751
  Array (message='Show depth 2'):
1494
- size: 2
1752
+ Array#size: 2
1495
1753
  Element 0: Fixnum 0
1496
1754
  Element 1:
1497
1755
  Array:
1498
- size: 2
1756
+ Array#size: 2
1499
1757
  Element 0: Fixnum 1
1500
1758
  Element 1: Array [2, [3, [4]]]
1501
1759
  ---
1502
1760
  Array (message='Show depth 3'):
1503
- size: 2
1761
+ Array#size: 2
1504
1762
  Element 0: Fixnum 0
1505
1763
  Element 1:
1506
1764
  Array:
1507
- size: 2
1765
+ Array#size: 2
1508
1766
  Element 0: Fixnum 1
1509
1767
  Element 1:
1510
1768
  Array:
1511
- size: 2
1769
+ Array#size: 2
1512
1770
  Element 0: Fixnum 2
1513
1771
  Element 1: Array [3, [4]]
1514
1772
  ---
1515
1773
  Array (message='Show depth 4'):
1516
- size: 2
1774
+ Array#size: 2
1517
1775
  Element 0: Fixnum 0
1518
1776
  Element 1:
1519
1777
  Array:
1520
- size: 2
1778
+ Array#size: 2
1521
1779
  Element 0: Fixnum 1
1522
1780
  Element 1:
1523
1781
  Array:
1524
- size: 2
1782
+ Array#size: 2
1525
1783
  Element 0: Fixnum 2
1526
1784
  Element 1:
1527
1785
  Array:
1528
- size: 2
1786
+ Array#size: 2
1529
1787
  Element 0: Fixnum 3
1530
1788
  Element 1: Array [4]
1531
1789
  ---
1532
1790
  Array (message='Show depth 5'):
1533
- size: 2
1791
+ Array#size: 2
1534
1792
  Element 0: Fixnum 0
1535
1793
  Element 1:
1536
1794
  Array:
1537
- size: 2
1795
+ Array#size: 2
1538
1796
  Element 0: Fixnum 1
1539
1797
  Element 1:
1540
1798
  Array:
1541
- size: 2
1799
+ Array#size: 2
1542
1800
  Element 0: Fixnum 2
1543
1801
  Element 1:
1544
1802
  Array:
1545
- size: 2
1803
+ Array#size: 2
1546
1804
  Element 0: Fixnum 3
1547
1805
  Element 1:
1548
1806
  Array:
1549
- size: 1
1807
+ Array#size: 1
1550
1808
  Element 0: Fixnum 4
1551
1809
  ```