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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +572 -314
- data/bin/console +14 -14
- data/lib/debug_helper/handler.rb +8 -2
- data/lib/debug_helper/version.rb +1 -1
- data/markdown/readme/Rakefile +2 -1
- data/markdown/readme/class_inclusions.md +1 -0
- data/markdown/readme/classes/array/circular/show.md +2 -2
- data/markdown/readme/classes/array/circular/show.yaml +2 -2
- data/markdown/readme/classes/array/mixed/show.md +9 -9
- data/markdown/readme/classes/array/mixed/show.yaml +9 -9
- data/markdown/readme/classes/array/nested/show.md +3 -3
- data/markdown/readme/classes/array/nested/show.yaml +3 -3
- data/markdown/readme/classes/array/simple/show.md +1 -1
- data/markdown/readme/classes/array/simple/show.yaml +1 -1
- data/markdown/readme/classes/custom/both/foo.rb +21 -0
- data/markdown/readme/classes/custom/both/foo_handler.rb +27 -0
- data/markdown/readme/classes/custom/both/show.md +100 -0
- data/markdown/readme/classes/custom/both/show.rb +5 -0
- data/markdown/readme/classes/custom/both/show.yaml +20 -0
- data/markdown/readme/classes/custom/both/template.md +19 -0
- data/markdown/readme/classes/custom/instance/foo.rb +13 -0
- data/markdown/readme/classes/custom/instance/foo_handler.rb +18 -0
- data/markdown/readme/classes/custom/instance/show.md +74 -0
- data/markdown/readme/classes/custom/instance/show.rb +5 -0
- data/markdown/readme/classes/custom/instance/show.yaml +11 -0
- data/markdown/readme/classes/custom/instance/template.md +19 -0
- data/markdown/readme/classes/custom/singleton/foo.rb +13 -0
- data/markdown/readme/classes/custom/singleton/foo_handler.rb +18 -0
- data/markdown/readme/classes/custom/singleton/show.md +74 -0
- data/markdown/readme/classes/custom/singleton/show.rb +5 -0
- data/markdown/readme/classes/custom/singleton/show.yaml +11 -0
- data/markdown/readme/classes/custom/singleton/template.md +19 -0
- data/markdown/readme/classes/custom/template.md +10 -0
- data/markdown/readme/classes/dir/simple/show.md +3 -3
- data/markdown/readme/classes/dir/simple/show.yaml +3 -3
- data/markdown/readme/classes/exception/simple/show.md +3 -3
- data/markdown/readme/classes/exception/simple/show.yaml +3 -3
- data/markdown/readme/classes/file/simple/show.md +17 -17
- data/markdown/readme/classes/file/simple/show.yaml +17 -17
- data/markdown/readme/classes/hash/circular/show.md +12 -12
- data/markdown/readme/classes/hash/circular/show.yaml +12 -12
- data/markdown/readme/classes/hash/mixed/show.md +20 -20
- data/markdown/readme/classes/hash/mixed/show.yaml +20 -20
- data/markdown/readme/classes/hash/nested/show.md +27 -27
- data/markdown/readme/classes/hash/nested/show.yaml +27 -27
- data/markdown/readme/classes/hash/simple/show.md +12 -12
- data/markdown/readme/classes/hash/simple/show.yaml +12 -12
- data/markdown/readme/classes/io/simple/show.md +4 -4
- data/markdown/readme/classes/io/simple/show.yaml +4 -4
- data/markdown/readme/classes/match_data/multiple_captures/show.md +5 -5
- data/markdown/readme/classes/match_data/multiple_captures/show.yaml +5 -5
- data/markdown/readme/classes/match_data/named_captures/show.md +5 -5
- data/markdown/readme/classes/match_data/named_captures/show.yaml +5 -5
- data/markdown/readme/classes/match_data/simple/show.md +5 -5
- data/markdown/readme/classes/match_data/simple/show.yaml +5 -5
- data/markdown/readme/classes/open_struct/circular/show.md +6 -6
- data/markdown/readme/classes/open_struct/circular/show.yaml +6 -6
- data/markdown/readme/classes/open_struct/mixed/show.md +17 -17
- data/markdown/readme/classes/open_struct/mixed/show.yaml +17 -17
- data/markdown/readme/classes/open_struct/nested/show.md +18 -18
- data/markdown/readme/classes/open_struct/nested/show.yaml +18 -18
- data/markdown/readme/classes/open_struct/simple/show.md +9 -9
- data/markdown/readme/classes/open_struct/simple/show.yaml +9 -9
- data/markdown/readme/classes/range/exclude_end/show.md +3 -3
- data/markdown/readme/classes/range/exclude_end/show.yaml +3 -3
- data/markdown/readme/classes/range/include_end/show.md +3 -3
- data/markdown/readme/classes/range/include_end/show.yaml +3 -3
- data/markdown/readme/classes/regexp/named_captures/show.md +5 -5
- data/markdown/readme/classes/regexp/named_captures/show.yaml +5 -5
- data/markdown/readme/classes/regexp/simple/show.md +5 -5
- data/markdown/readme/classes/regexp/simple/show.yaml +5 -5
- data/markdown/readme/classes/set/circular/show.md +2 -2
- data/markdown/readme/classes/set/circular/show.yaml +2 -2
- data/markdown/readme/classes/set/mixed/show.md +9 -9
- data/markdown/readme/classes/set/mixed/show.yaml +9 -9
- data/markdown/readme/classes/set/nested/show.md +3 -3
- data/markdown/readme/classes/set/nested/show.yaml +3 -3
- data/markdown/readme/classes/set/simple/show.md +1 -1
- data/markdown/readme/classes/set/simple/show.yaml +1 -1
- data/markdown/readme/classes/string/multiline/show.md +5 -5
- data/markdown/readme/classes/string/multiline/show.yaml +5 -5
- data/markdown/readme/classes/string/simple/show.md +5 -5
- data/markdown/readme/classes/string/simple/show.yaml +5 -5
- data/markdown/readme/classes/struct/circular/show.md +20 -20
- data/markdown/readme/classes/struct/circular/show.yaml +20 -20
- data/markdown/readme/classes/struct/mixed/show.md +18 -18
- data/markdown/readme/classes/struct/mixed/show.yaml +18 -18
- data/markdown/readme/classes/struct/nested/show.md +21 -21
- data/markdown/readme/classes/struct/nested/show.yaml +21 -21
- data/markdown/readme/classes/struct/simple/show.md +10 -10
- data/markdown/readme/classes/struct/simple/show.yaml +10 -10
- data/markdown/readme/classes/symbol/simple/show.md +3 -3
- data/markdown/readme/classes/symbol/simple/show.yaml +3 -3
- data/markdown/readme/options/depth/show.md +15 -15
- data/markdown/readme/options/depth/show.yaml +15 -15
- data/markdown/readme/template.md +11 -8
- metadata +21 -2
@@ -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,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,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,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)
|
@@ -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
|
27
|
+
Dir.exist?("."): true
|
28
28
|
```
|
@@ -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'
|
@@ -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
|
23
|
-
exist
|
24
|
-
ftype: file
|
25
|
-
mtime: 2018-07-14 12:45:32.000000000 -05:00
|
26
|
-
path: show.rb
|
27
|
-
pipe
|
28
|
-
readable
|
29
|
-
realpath: C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
|
30
|
-
setgid
|
31
|
-
setuid
|
32
|
-
size: 95
|
33
|
-
socket
|
34
|
-
symlink
|
35
|
-
writable
|
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
|
7
|
-
exist
|
8
|
-
ftype: file
|
9
|
-
mtime: 2018-07-14 12:45:32.000000000 -05:00
|
10
|
-
path: show.rb
|
11
|
-
pipe
|
12
|
-
readable
|
13
|
-
realpath: C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
|
14
|
-
setgid
|
15
|
-
setuid
|
16
|
-
size: 95
|
17
|
-
socket
|
18
|
-
symlink
|
19
|
-
writable
|
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
|
```
|