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
@@ -0,0 +1,18 @@
1
+ require 'debug_helper'
2
+
3
+ class DebugHelper
4
+
5
+ class FooHandler < Handler
6
+
7
+ def calls_for_instance
8
+ [
9
+ [:my_array],
10
+ [:my_hash],
11
+ [:respond_to?, :your_array],
12
+ [:respond_to?, :your_hash],
13
+ ]
14
+ end
15
+
16
+ end
17
+
18
+ end
@@ -0,0 +1,74 @@
1
+ #### Instance Methods
2
+
3
+ This example shows a custom handler that explicates via instance methods.
4
+
5
+ Here's a class ```Foo``` that has some instance methods:
6
+
7
+ ```foo.rb```:
8
+ ```ruby
9
+ require 'debug_helper'
10
+
11
+ class Foo
12
+
13
+ def my_array
14
+ %w/foo bar baz/
15
+ end
16
+
17
+ def my_hash
18
+ {:a => 0, :b => 1}
19
+ end
20
+
21
+ end
22
+ ```
23
+
24
+ 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.
25
+
26
+ ```foo_handler.rb```:
27
+ ```ruby
28
+ require 'debug_helper'
29
+
30
+ class DebugHelper
31
+
32
+ class FooHandler < Handler
33
+
34
+ def calls_for_instance
35
+ [
36
+ [:my_array],
37
+ [:my_hash],
38
+ [:respond_to?, :your_array],
39
+ [:respond_to?, :your_hash],
40
+ ]
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+ ```
47
+
48
+ Here's a program that uses the custom handler.
49
+
50
+ ```show.rb```:
51
+ ```ruby
52
+ require 'debug_helper'
53
+ require_relative 'foo'
54
+ require_relative 'foo_handler'
55
+
56
+ DebugHelper.show(Foo.new, 'My class Foo')
57
+ ```
58
+
59
+ The output shows details of the object.
60
+
61
+ ```show.yaml```:
62
+ ```yaml
63
+ ---
64
+ Foo (message='My class Foo'):
65
+ Foo#my_array:
66
+ - foo
67
+ - bar
68
+ - baz
69
+ Foo#my_hash:
70
+ :a: 0
71
+ :b: 1
72
+ Foo#respond_to?(:your_array): false
73
+ Foo#respond_to?(:your_hash): false
74
+ ```
@@ -0,0 +1,5 @@
1
+ require 'debug_helper'
2
+ require_relative 'foo'
3
+ require_relative 'foo_handler'
4
+
5
+ DebugHelper.show(Foo.new, 'My class Foo')
@@ -0,0 +1,11 @@
1
+ ---
2
+ Foo (message='My class Foo'):
3
+ Foo#my_array:
4
+ - foo
5
+ - bar
6
+ - baz
7
+ Foo#my_hash:
8
+ :a: 0
9
+ :b: 1
10
+ Foo#respond_to?(:your_array): false
11
+ Foo#respond_to?(:your_hash): false
@@ -0,0 +1,19 @@
1
+ #### Instance Methods
2
+
3
+ This example shows a custom handler that explicates via instance methods.
4
+
5
+ Here's a class ```Foo``` that has some instance methods:
6
+
7
+ @[ruby](foo.rb)
8
+
9
+ 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.
10
+
11
+ @[ruby](foo_handler.rb)
12
+
13
+ Here's a program that uses the custom handler.
14
+
15
+ @[ruby](show.rb)
16
+
17
+ The output shows details of the object.
18
+
19
+ @[yaml](show.yaml)
@@ -0,0 +1,13 @@
1
+ require 'debug_helper'
2
+
3
+ class Foo
4
+
5
+ def self.my_array
6
+ %w/bat bam bad/
7
+ end
8
+
9
+ def self.my_hash
10
+ {:c => 2, :d => 3}
11
+ end
12
+
13
+ end
@@ -0,0 +1,18 @@
1
+ require 'debug_helper'
2
+
3
+ class DebugHelper
4
+
5
+ class FooHandler < Handler
6
+
7
+ def calls_for_class
8
+ [
9
+ [:my_array],
10
+ [:my_hash],
11
+ [:respond_to?, :your_array],
12
+ [:respond_to?, :your_hash],
13
+ ]
14
+ end
15
+
16
+ end
17
+
18
+ end
@@ -0,0 +1,74 @@
1
+ #### Singleton Methods
2
+
3
+ This example shows a custom handler that explicates via singleton methods.
4
+
5
+ Here's a class ```Foo``` that has some singleton methods:
6
+
7
+ ```foo.rb```:
8
+ ```ruby
9
+ require 'debug_helper'
10
+
11
+ class Foo
12
+
13
+ def self.my_array
14
+ %w/bat bam bad/
15
+ end
16
+
17
+ def self.my_hash
18
+ {:c => 2, :d => 3}
19
+ end
20
+
21
+ end
22
+ ```
23
+
24
+ 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.
25
+
26
+ ```foo_handler.rb```:
27
+ ```ruby
28
+ require 'debug_helper'
29
+
30
+ class DebugHelper
31
+
32
+ class FooHandler < Handler
33
+
34
+ def calls_for_class
35
+ [
36
+ [:my_array],
37
+ [:my_hash],
38
+ [:respond_to?, :your_array],
39
+ [:respond_to?, :your_hash],
40
+ ]
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+ ```
47
+
48
+ Here's a program that uses the custom handler.
49
+
50
+ ```show.rb```:
51
+ ```ruby
52
+ require 'debug_helper'
53
+ require_relative 'foo'
54
+ require_relative 'foo_handler'
55
+
56
+ DebugHelper.show(Foo.new, 'My class Foo')
57
+ ```
58
+
59
+ The output shows details of the object.
60
+
61
+ ```show.yaml```:
62
+ ```yaml
63
+ ---
64
+ Foo (message='My class Foo'):
65
+ Foo.my_array:
66
+ - bat
67
+ - bam
68
+ - bad
69
+ Foo.my_hash:
70
+ :c: 2
71
+ :d: 3
72
+ Foo.respond_to?(:your_array): false
73
+ Foo.respond_to?(:your_hash): false
74
+ ```
@@ -0,0 +1,5 @@
1
+ require 'debug_helper'
2
+ require_relative 'foo'
3
+ require_relative 'foo_handler'
4
+
5
+ DebugHelper.show(Foo.new, 'My class Foo')
@@ -0,0 +1,11 @@
1
+ ---
2
+ Foo (message='My class Foo'):
3
+ Foo.my_array:
4
+ - bat
5
+ - bam
6
+ - bad
7
+ Foo.my_hash:
8
+ :c: 2
9
+ :d: 3
10
+ Foo.respond_to?(:your_array): false
11
+ Foo.respond_to?(:your_hash): false
@@ -0,0 +1,19 @@
1
+ #### Singleton Methods
2
+
3
+ This example shows a custom handler that explicates via singleton methods.
4
+
5
+ Here's a class ```Foo``` that has some singleton methods:
6
+
7
+ @[ruby](foo.rb)
8
+
9
+ 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.
10
+
11
+ @[ruby](foo_handler.rb)
12
+
13
+ Here's a program that uses the custom handler.
14
+
15
+ @[ruby](show.rb)
16
+
17
+ The output shows details of the object.
18
+
19
+ @[yaml](show.yaml)
@@ -0,0 +1,10 @@
1
+ ### Custom
2
+
3
+ You can create custom handlers for your own classes.
4
+
5
+ @[:markdown](instance/show.md)
6
+
7
+ @[:markdown](singleton/show.md)
8
+
9
+ @[:markdown](both/show.md)
10
+
@@ -16,13 +16,13 @@ The output shows details of the ```Dir```.
16
16
  ```yaml
17
17
  ---
18
18
  Dir (message='My simple dir'):
19
- path: "."
20
- entries:
19
+ Dir#path: "."
20
+ Dir.entries("."):
21
21
  - "."
22
22
  - ".."
23
23
  - show.md
24
24
  - show.rb
25
25
  - show.yaml
26
26
  - template.md
27
- exist?: true
27
+ Dir.exist?("."): true
28
28
  ```
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  Dir (message='My simple dir'):
3
- path: "."
4
- entries:
3
+ Dir#path: "."
4
+ Dir.entries("."):
5
5
  - "."
6
6
  - ".."
7
7
  - show.md
8
8
  - show.rb
9
9
  - show.yaml
10
10
  - template.md
11
- exist?: true
11
+ Dir.exist?("."): true
@@ -34,9 +34,9 @@ The output shows details of the ```Exception```.
34
34
  ```yaml
35
35
  ---
36
36
  Exception (message='My simple exception'):
37
- message: Boo!
38
- cause:
39
- backtrace:
37
+ Exception#message: Boo!
38
+ Exception#cause:
39
+ Exception#backtrace:
40
40
  - show.rb:6:in `foo'
41
41
  - show.rb:14:in `bar'
42
42
  - show.rb:18:in `baz'
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  Exception (message='My simple exception'):
3
- message: Boo!
4
- cause:
5
- backtrace:
3
+ Exception#message: Boo!
4
+ Exception#cause:
5
+ Exception#backtrace:
6
6
  - show.rb:6:in `foo'
7
7
  - show.rb:14:in `bar'
8
8
  - show.rb:18:in `baz'
@@ -16,21 +16,21 @@ The output shows details of the file.
16
16
  ```yaml
17
17
  ---
18
18
  File (message='My simple file'):
19
- absolute_path: C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
20
- atime: 2018-07-14 12:45:32.000000000 -05:00
21
- ctime: 2018-07-14 12:45:32.000000000 -05:00
22
- executable?: false
23
- exist?: true
24
- ftype: file
25
- mtime: 2018-07-14 12:45:32.000000000 -05:00
26
- path: show.rb
27
- pipe?: false
28
- readable?: true
29
- realpath: C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
30
- setgid?: false
31
- setuid?: false
32
- size: 95
33
- socket?: false
34
- symlink?: false
35
- writable?: true
19
+ File.absolute_path("show.rb"): C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
20
+ File.atime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
21
+ File.ctime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
22
+ File.executable?("show.rb"): false
23
+ File.exist?("show.rb"): true
24
+ File.ftype("show.rb"): file
25
+ File.mtime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
26
+ File.path("show.rb"): show.rb
27
+ File.pipe?("show.rb"): false
28
+ File.readable?("show.rb"): true
29
+ File.realpath("show.rb"): C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
30
+ File.setgid?("show.rb"): false
31
+ File.setuid?("show.rb"): false
32
+ File.size("show.rb"): 95
33
+ File.socket?("show.rb"): false
34
+ File.symlink?("show.rb"): false
35
+ File.writable?("show.rb"): true
36
36
  ```
@@ -1,19 +1,19 @@
1
1
  ---
2
2
  File (message='My simple file'):
3
- absolute_path: C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
4
- atime: 2018-07-14 12:45:32.000000000 -05:00
5
- ctime: 2018-07-14 12:45:32.000000000 -05:00
6
- executable?: false
7
- exist?: true
8
- ftype: file
9
- mtime: 2018-07-14 12:45:32.000000000 -05:00
10
- path: show.rb
11
- pipe?: false
12
- readable?: true
13
- realpath: C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
14
- setgid?: false
15
- setuid?: false
16
- size: 95
17
- socket?: false
18
- symlink?: false
19
- writable?: true
3
+ File.absolute_path("show.rb"): C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
4
+ File.atime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
5
+ File.ctime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
6
+ File.executable?("show.rb"): false
7
+ File.exist?("show.rb"): true
8
+ File.ftype("show.rb"): file
9
+ File.mtime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
10
+ File.path("show.rb"): show.rb
11
+ File.pipe?("show.rb"): false
12
+ File.readable?("show.rb"): true
13
+ File.realpath("show.rb"): C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
14
+ File.setgid?("show.rb"): false
15
+ File.setuid?("show.rb"): false
16
+ File.size("show.rb"): 95
17
+ File.socket?("show.rb"): false
18
+ File.symlink?("show.rb"): false
19
+ File.writable?("show.rb"): true
@@ -21,25 +21,25 @@ The circular reference is not followed.
21
21
  ```yaml
22
22
  ---
23
23
  Hash (message='My circular hashes'):
24
- size: 1
25
- default:
26
- default_proc:
24
+ Hash#size: 1
25
+ Hash#default:
26
+ Hash#default_proc:
27
27
  Pair 0:
28
28
  Key:
29
29
  Symbol:
30
- to_s: foo
31
- size: 3
32
- encoding: !ruby/encoding US-ASCII
30
+ Symbol#to_s: foo
31
+ Symbol#size: 3
32
+ Symbol#encoding: !ruby/encoding US-ASCII
33
33
  Value:
34
34
  Hash:
35
- size: 1
36
- default:
37
- default_proc:
35
+ Hash#size: 1
36
+ Hash#default:
37
+ Hash#default_proc:
38
38
  Pair 0:
39
39
  Key:
40
40
  Symbol:
41
- to_s: bar
42
- size: 3
43
- encoding: !ruby/encoding US-ASCII
41
+ Symbol#to_s: bar
42
+ Symbol#size: 3
43
+ Symbol#encoding: !ruby/encoding US-ASCII
44
44
  Value: Hash {:foo=>{:bar=>{...}}}
45
45
  ```