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.
- checksums.yaml +4 -4
- data/Gemfile.lock +22 -22
- data/README.md +848 -218
- data/lib/debug_helper.rb +79 -160
- data/lib/debug_helper/array_handler.rb +12 -0
- data/lib/debug_helper/dir_handler.rb +19 -0
- data/lib/debug_helper/each_pair_handler.rb +13 -0
- data/lib/debug_helper/each_with_index_handler.rb +11 -0
- data/lib/debug_helper/exception_handler.rb +14 -0
- data/lib/debug_helper/file_handler.rb +29 -0
- data/lib/debug_helper/generic_handler.rb +12 -0
- data/lib/debug_helper/handler.rb +102 -0
- data/lib/debug_helper/hash_handler.rb +19 -0
- data/lib/debug_helper/io_handler.rb +15 -0
- data/lib/debug_helper/match_data_handler.rb +17 -0
- data/lib/debug_helper/object_handler.rb +13 -0
- data/lib/debug_helper/open_struct_handler.rb +16 -0
- data/lib/debug_helper/range_handler.rb +14 -0
- data/lib/debug_helper/regexp_handler.rb +16 -0
- data/lib/debug_helper/set_handler.rb +12 -0
- data/lib/debug_helper/string_handler.rb +17 -0
- data/lib/debug_helper/struct_handler.rb +18 -0
- data/lib/debug_helper/symbol_handler.rb +15 -0
- data/lib/debug_helper/version.rb +3 -3
- data/markdown/readme/Rakefile +36 -6
- data/markdown/readme/class_inclusions.md +10 -3
- data/markdown/readme/class_links.md +10 -3
- data/markdown/readme/classes/array/circular/show.md +4 -2
- data/markdown/readme/classes/array/circular/show.yaml +4 -2
- data/markdown/readme/classes/array/mixed/show.md +6 -3
- data/markdown/readme/classes/array/mixed/show.yaml +6 -3
- data/markdown/readme/classes/array/nested/show.md +6 -3
- data/markdown/readme/classes/array/nested/show.yaml +6 -3
- data/markdown/readme/classes/array/simple/show.md +2 -1
- data/markdown/readme/classes/array/simple/show.yaml +2 -1
- data/markdown/readme/classes/dir/simple/show.md +28 -0
- data/markdown/readme/classes/dir/simple/show.rb +4 -0
- data/markdown/readme/classes/dir/simple/show.yaml +11 -0
- data/markdown/readme/classes/dir/simple/template.md +9 -0
- data/markdown/readme/classes/dir/template.md +3 -0
- data/markdown/readme/classes/exception/simple/show.md +44 -0
- data/markdown/readme/classes/exception/simple/show.rb +22 -0
- data/markdown/readme/classes/exception/simple/show.yaml +9 -0
- data/markdown/readme/classes/exception/simple/template.md +9 -0
- data/markdown/readme/classes/exception/template.md +3 -0
- data/markdown/readme/classes/file/simple/show.md +3 -3
- data/markdown/readme/classes/file/simple/show.yaml +3 -3
- data/markdown/readme/classes/hash/circular/show.md +12 -4
- data/markdown/readme/classes/hash/circular/show.yaml +12 -4
- data/markdown/readme/classes/hash/mixed/show.md +14 -6
- data/markdown/readme/classes/hash/mixed/show.yaml +14 -6
- data/markdown/readme/classes/hash/nested/show.md +24 -9
- data/markdown/readme/classes/hash/nested/show.yaml +24 -9
- data/markdown/readme/classes/hash/simple/show.md +10 -4
- data/markdown/readme/classes/hash/simple/show.yaml +10 -4
- data/markdown/readme/classes/io/simple/show.md +23 -0
- data/markdown/readme/classes/io/simple/show.rb +4 -0
- data/markdown/readme/classes/io/simple/show.yaml +6 -0
- data/markdown/readme/classes/io/simple/template.md +9 -0
- data/markdown/readme/classes/io/template.md +3 -0
- data/markdown/readme/classes/match_data/multiple_captures/show.md +33 -0
- data/markdown/readme/classes/match_data/multiple_captures/show.rb +4 -0
- data/markdown/readme/classes/match_data/multiple_captures/show.yaml +16 -0
- data/markdown/readme/classes/match_data/multiple_captures/template.md +9 -0
- data/markdown/readme/classes/match_data/named_captures/show.md +31 -0
- data/markdown/readme/classes/match_data/named_captures/show.rb +4 -0
- data/markdown/readme/classes/match_data/named_captures/show.yaml +14 -0
- data/markdown/readme/classes/match_data/named_captures/template.md +9 -0
- data/markdown/readme/classes/match_data/simple/show.md +25 -0
- data/markdown/readme/classes/match_data/simple/show.rb +4 -0
- data/markdown/readme/classes/match_data/simple/show.yaml +8 -0
- data/markdown/readme/classes/match_data/simple/template.md +9 -0
- data/markdown/readme/classes/match_data/template.md +7 -0
- data/markdown/readme/classes/object/object/show.md +23 -0
- data/markdown/readme/classes/object/object/show.rb +8 -0
- data/markdown/readme/classes/object/object/show.yaml +2 -0
- data/markdown/readme/classes/object/object/template.md +9 -0
- data/markdown/readme/classes/object/template.md +1 -7
- data/markdown/readme/classes/open_struct/circular/show.md +40 -0
- data/markdown/readme/classes/open_struct/circular/show.rb +8 -0
- data/markdown/readme/classes/open_struct/circular/show.yaml +17 -0
- data/markdown/readme/classes/open_struct/circular/template.md +11 -0
- data/markdown/readme/classes/open_struct/mixed/show.md +51 -0
- data/markdown/readme/classes/open_struct/mixed/show.rb +5 -0
- data/markdown/readme/classes/open_struct/mixed/show.yaml +33 -0
- data/markdown/readme/classes/open_struct/mixed/template.md +9 -0
- data/markdown/readme/classes/open_struct/nested/show.md +73 -0
- data/markdown/readme/classes/open_struct/nested/show.rb +14 -0
- data/markdown/readme/classes/open_struct/nested/show.yaml +46 -0
- data/markdown/readme/classes/open_struct/nested/template.md +9 -0
- data/markdown/readme/classes/open_struct/simple/show.md +41 -0
- data/markdown/readme/classes/open_struct/simple/show.rb +5 -0
- data/markdown/readme/classes/open_struct/simple/show.yaml +23 -0
- data/markdown/readme/classes/open_struct/simple/template.md +9 -0
- data/markdown/readme/classes/open_struct/template.md +9 -0
- data/markdown/readme/classes/range/exclude_end/show.md +22 -0
- data/markdown/readme/classes/range/exclude_end/show.rb +4 -0
- data/markdown/readme/classes/range/exclude_end/show.yaml +5 -0
- data/markdown/readme/classes/range/exclude_end/template.md +9 -0
- data/markdown/readme/classes/range/include_end/show.md +22 -0
- data/markdown/readme/classes/range/include_end/show.rb +4 -0
- data/markdown/readme/classes/range/include_end/show.yaml +5 -0
- data/markdown/readme/classes/range/include_end/template.md +9 -0
- data/markdown/readme/classes/range/template.md +5 -0
- data/markdown/readme/classes/regexp/named_captures/show.md +28 -0
- data/markdown/readme/classes/regexp/named_captures/show.rb +4 -0
- data/markdown/readme/classes/regexp/named_captures/show.yaml +11 -0
- data/markdown/readme/classes/regexp/named_captures/template.md +9 -0
- data/markdown/readme/classes/regexp/simple/show.md +24 -0
- data/markdown/readme/classes/regexp/simple/show.rb +4 -0
- data/markdown/readme/classes/regexp/simple/show.yaml +7 -0
- data/markdown/readme/classes/regexp/simple/template.md +9 -0
- data/markdown/readme/classes/regexp/template.md +5 -0
- data/markdown/readme/classes/set/circular/show.md +4 -2
- data/markdown/readme/classes/set/circular/show.yaml +4 -2
- data/markdown/readme/classes/set/mixed/show.md +6 -3
- data/markdown/readme/classes/set/mixed/show.yaml +6 -3
- data/markdown/readme/classes/set/nested/show.md +6 -3
- data/markdown/readme/classes/set/nested/show.yaml +6 -3
- data/markdown/readme/classes/set/simple/show.md +2 -1
- data/markdown/readme/classes/set/simple/show.yaml +2 -1
- data/markdown/readme/classes/string/multiline/show.md +2 -1
- data/markdown/readme/classes/string/multiline/show.yaml +2 -1
- data/markdown/readme/classes/string/simple/show.md +2 -1
- data/markdown/readme/classes/string/simple/show.yaml +2 -1
- data/markdown/readme/classes/struct/circular/show.md +34 -8
- data/markdown/readme/classes/struct/circular/show.yaml +34 -8
- data/markdown/readme/classes/struct/mixed/show.md +21 -6
- data/markdown/readme/classes/struct/mixed/show.yaml +21 -6
- data/markdown/readme/classes/struct/nested/show.md +36 -9
- data/markdown/readme/classes/struct/nested/show.yaml +36 -9
- data/markdown/readme/classes/struct/simple/show.md +17 -4
- data/markdown/readme/classes/struct/simple/show.yaml +17 -4
- data/markdown/readme/classes/symbol/simple/show.md +2 -1
- data/markdown/readme/classes/symbol/simple/show.yaml +2 -1
- data/markdown/readme/options/depth/show.md +30 -15
- data/markdown/readme/options/depth/show.yaml +30 -15
- data/markdown/readme/template.md +8 -8
- metadata +88 -14
- data/markdown/readme/classes/object/datetime/show.md +0 -18
- data/markdown/readme/classes/object/datetime/show.rb +0 -4
- data/markdown/readme/classes/object/datetime/show.yaml +0 -1
- data/markdown/readme/classes/object/datetime/template.md +0 -9
- data/markdown/readme/classes/object/range/show.md +0 -19
- data/markdown/readme/classes/object/range/show.rb +0 -4
- data/markdown/readme/classes/object/range/show.yaml +0 -2
- data/markdown/readme/classes/object/range/template.md +0 -9
- data/markdown/readme/classes/object/regexp/show.md +0 -19
- data/markdown/readme/classes/object/regexp/show.rb +0 -4
- data/markdown/readme/classes/object/regexp/show.yaml +0 -2
- data/markdown/readme/classes/object/regexp/template.md +0 -9
@@ -15,23 +15,29 @@ The output shows details of the hash.
|
|
15
15
|
```show.yaml```:
|
16
16
|
```yaml
|
17
17
|
---
|
18
|
-
Hash (
|
18
|
+
Hash (message='My simple hash'):
|
19
|
+
size: 3
|
20
|
+
default:
|
21
|
+
default_proc:
|
19
22
|
Pair 0:
|
20
23
|
Key:
|
21
|
-
Symbol
|
24
|
+
Symbol:
|
22
25
|
to_s: a
|
26
|
+
size: 1
|
23
27
|
encoding: !ruby/encoding US-ASCII
|
24
28
|
Value: Fixnum 0
|
25
29
|
Pair 1:
|
26
30
|
Key:
|
27
|
-
Symbol
|
31
|
+
Symbol:
|
28
32
|
to_s: b
|
33
|
+
size: 1
|
29
34
|
encoding: !ruby/encoding US-ASCII
|
30
35
|
Value: Fixnum 1
|
31
36
|
Pair 2:
|
32
37
|
Key:
|
33
|
-
Symbol
|
38
|
+
Symbol:
|
34
39
|
to_s: c
|
40
|
+
size: 1
|
35
41
|
encoding: !ruby/encoding US-ASCII
|
36
42
|
Value: Fixnum 2
|
37
43
|
```
|
@@ -1,20 +1,26 @@
|
|
1
1
|
---
|
2
|
-
Hash (
|
2
|
+
Hash (message='My simple hash'):
|
3
|
+
size: 3
|
4
|
+
default:
|
5
|
+
default_proc:
|
3
6
|
Pair 0:
|
4
7
|
Key:
|
5
|
-
Symbol
|
8
|
+
Symbol:
|
6
9
|
to_s: a
|
10
|
+
size: 1
|
7
11
|
encoding: !ruby/encoding US-ASCII
|
8
12
|
Value: Fixnum 0
|
9
13
|
Pair 1:
|
10
14
|
Key:
|
11
|
-
Symbol
|
15
|
+
Symbol:
|
12
16
|
to_s: b
|
17
|
+
size: 1
|
13
18
|
encoding: !ruby/encoding US-ASCII
|
14
19
|
Value: Fixnum 1
|
15
20
|
Pair 2:
|
16
21
|
Key:
|
17
|
-
Symbol
|
22
|
+
Symbol:
|
18
23
|
to_s: c
|
24
|
+
size: 1
|
19
25
|
encoding: !ruby/encoding US-ASCII
|
20
26
|
Value: Fixnum 2
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#### Simple IO
|
2
|
+
|
3
|
+
This example shows a simple ```IO```.
|
4
|
+
|
5
|
+
```show.rb```:
|
6
|
+
```ruby
|
7
|
+
require 'debug_helper'
|
8
|
+
|
9
|
+
io = IO.new(IO.sysopen(__FILE__, 'r'), 'r')
|
10
|
+
DebugHelper.show(io, 'My simple io')
|
11
|
+
```
|
12
|
+
|
13
|
+
The output shows details of the ```IO```.
|
14
|
+
|
15
|
+
```show.yaml```:
|
16
|
+
```yaml
|
17
|
+
---
|
18
|
+
IO (message='My simple io'):
|
19
|
+
autoclose?: true
|
20
|
+
binmode?: false
|
21
|
+
closed?: false
|
22
|
+
tty?: false
|
23
|
+
```
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#### Multiple Captures
|
2
|
+
|
3
|
+
This example shows a ```MatchData``` with multiple captures.
|
4
|
+
|
5
|
+
```show.rb```:
|
6
|
+
```ruby
|
7
|
+
require 'debug_helper'
|
8
|
+
|
9
|
+
match_data = /(.)(.)(\d+)(\d)/.match('THX1138.')
|
10
|
+
DebugHelper.show(match_data, 'My MatchData with named captures')
|
11
|
+
```
|
12
|
+
|
13
|
+
The output shows details of the ```MatchData```.
|
14
|
+
|
15
|
+
```show.yaml```:
|
16
|
+
```yaml
|
17
|
+
---
|
18
|
+
MatchData (message='My MatchData with named captures'):
|
19
|
+
size: 5
|
20
|
+
regexp: !ruby/regexp /(.)(.)(\d+)(\d)/
|
21
|
+
to_a:
|
22
|
+
- HX1138
|
23
|
+
- H
|
24
|
+
- X
|
25
|
+
- '113'
|
26
|
+
- '8'
|
27
|
+
captures:
|
28
|
+
- H
|
29
|
+
- X
|
30
|
+
- '113'
|
31
|
+
- '8'
|
32
|
+
names: []
|
33
|
+
```
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#### Named Captures
|
2
|
+
|
3
|
+
This example shows a ```MatchData``` with named captures.
|
4
|
+
|
5
|
+
```show.rb```:
|
6
|
+
```ruby
|
7
|
+
require 'debug_helper'
|
8
|
+
|
9
|
+
match_data = /(?<x>.)(?<y>.)?/.match("a")
|
10
|
+
DebugHelper.show(match_data, 'My MatchData with named captures')
|
11
|
+
```
|
12
|
+
|
13
|
+
The output shows details of the ```MatchData```.
|
14
|
+
|
15
|
+
```show.yaml```:
|
16
|
+
```yaml
|
17
|
+
---
|
18
|
+
MatchData (message='My MatchData with named captures'):
|
19
|
+
size: 3
|
20
|
+
regexp: !ruby/regexp /(?<x>.)(?<y>.)?/
|
21
|
+
to_a:
|
22
|
+
- a
|
23
|
+
- a
|
24
|
+
-
|
25
|
+
captures:
|
26
|
+
- a
|
27
|
+
-
|
28
|
+
names:
|
29
|
+
- x
|
30
|
+
- y
|
31
|
+
```
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#### Simple MatchData
|
2
|
+
|
3
|
+
This example shows a simple ```MatchData```.
|
4
|
+
|
5
|
+
```show.rb```:
|
6
|
+
```ruby
|
7
|
+
require 'debug_helper'
|
8
|
+
|
9
|
+
match_data = /[a-z]/.match('abc')
|
10
|
+
DebugHelper.show(match_data, 'My simple MatchData')
|
11
|
+
```
|
12
|
+
|
13
|
+
The output shows details of the ```MatchData```.
|
14
|
+
|
15
|
+
```show.yaml```:
|
16
|
+
```yaml
|
17
|
+
---
|
18
|
+
MatchData (message='My simple MatchData'):
|
19
|
+
size: 1
|
20
|
+
regexp: !ruby/regexp /[a-z]/
|
21
|
+
to_a:
|
22
|
+
- a
|
23
|
+
captures: []
|
24
|
+
names: []
|
25
|
+
```
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#### Unanalyzed Object
|
2
|
+
|
3
|
+
This example shows an object that will not be analyzed.
|
4
|
+
|
5
|
+
```show.rb```:
|
6
|
+
```ruby
|
7
|
+
require 'debug_helper'
|
8
|
+
|
9
|
+
class MyClass
|
10
|
+
def inspect
|
11
|
+
'My class inspection'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
DebugHelper.show(MyClass.new, 'My class')
|
15
|
+
```
|
16
|
+
|
17
|
+
The output shows details of the object.
|
18
|
+
|
19
|
+
```show.yaml```:
|
20
|
+
```yaml
|
21
|
+
--- MyClass (message='My class') My class inspection
|
22
|
+
...
|
23
|
+
```
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#### Circular OpenStructs
|
2
|
+
|
3
|
+
This example shows open structs that make a circular reference.
|
4
|
+
|
5
|
+
```show.rb```:
|
6
|
+
```ruby
|
7
|
+
require 'ostruct'
|
8
|
+
require 'debug_helper'
|
9
|
+
|
10
|
+
ostruct_0 = OpenStruct.new
|
11
|
+
ostruct_1 = OpenStruct.new
|
12
|
+
ostruct_0.a = ostruct_1
|
13
|
+
ostruct_1.a = ostruct_0
|
14
|
+
DebugHelper.show(ostruct_0, 'My circular ostruct')
|
15
|
+
```
|
16
|
+
|
17
|
+
The output shows details of the open structs.
|
18
|
+
|
19
|
+
The circular reference is not followed.
|
20
|
+
|
21
|
+
```show.yaml```:
|
22
|
+
```yaml
|
23
|
+
---
|
24
|
+
OpenStruct (message='My circular ostruct'):
|
25
|
+
Member 0:
|
26
|
+
Name:
|
27
|
+
Symbol:
|
28
|
+
to_s: a
|
29
|
+
size: 1
|
30
|
+
encoding: !ruby/encoding US-ASCII
|
31
|
+
Value:
|
32
|
+
OpenStruct:
|
33
|
+
Member 0:
|
34
|
+
Name:
|
35
|
+
Symbol:
|
36
|
+
to_s: a
|
37
|
+
size: 1
|
38
|
+
encoding: !ruby/encoding US-ASCII
|
39
|
+
Value: 'OpenStruct #<OpenStruct a=#<OpenStruct a=#<OpenStruct ...>>>'
|
40
|
+
```
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
OpenStruct (message='My circular ostruct'):
|
3
|
+
Member 0:
|
4
|
+
Name:
|
5
|
+
Symbol:
|
6
|
+
to_s: a
|
7
|
+
size: 1
|
8
|
+
encoding: !ruby/encoding US-ASCII
|
9
|
+
Value:
|
10
|
+
OpenStruct:
|
11
|
+
Member 0:
|
12
|
+
Name:
|
13
|
+
Symbol:
|
14
|
+
to_s: a
|
15
|
+
size: 1
|
16
|
+
encoding: !ruby/encoding US-ASCII
|
17
|
+
Value: 'OpenStruct #<OpenStruct a=#<OpenStruct a=#<OpenStruct ...>>>'
|