debug_helper 1.0.0 → 1.5.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +37 -18
  4. data/lib/debug_helper.rb +38 -44
  5. data/lib/debug_helper/version.rb +1 -1
  6. data/markdown/readme/classes/array/circular/show.md +1 -1
  7. data/markdown/readme/classes/array/circular/show.yaml +1 -1
  8. data/markdown/readme/classes/array/mixed/show.md +1 -1
  9. data/markdown/readme/classes/array/mixed/show.yaml +1 -1
  10. data/markdown/readme/classes/array/nested/show.md +1 -1
  11. data/markdown/readme/classes/array/nested/show.yaml +1 -1
  12. data/markdown/readme/classes/array/simple/show.md +1 -1
  13. data/markdown/readme/classes/array/simple/show.yaml +1 -1
  14. data/markdown/readme/classes/hash/circular/show.md +1 -1
  15. data/markdown/readme/classes/hash/circular/show.yaml +1 -1
  16. data/markdown/readme/classes/hash/mixed/show.md +1 -1
  17. data/markdown/readme/classes/hash/mixed/show.yaml +1 -1
  18. data/markdown/readme/classes/hash/nested/show.md +1 -1
  19. data/markdown/readme/classes/hash/nested/show.yaml +1 -1
  20. data/markdown/readme/classes/hash/simple/show.md +1 -1
  21. data/markdown/readme/classes/hash/simple/show.yaml +1 -1
  22. data/markdown/readme/classes/object/datetime/show.md +1 -1
  23. data/markdown/readme/classes/object/datetime/show.yaml +1 -1
  24. data/markdown/readme/classes/object/range/show.md +1 -1
  25. data/markdown/readme/classes/object/range/show.yaml +1 -1
  26. data/markdown/readme/classes/object/regexp/show.md +1 -1
  27. data/markdown/readme/classes/object/regexp/show.yaml +1 -1
  28. data/markdown/readme/classes/string/multiline/show.md +1 -1
  29. data/markdown/readme/classes/string/multiline/show.yaml +1 -1
  30. data/markdown/readme/classes/string/simple/show.md +1 -1
  31. data/markdown/readme/classes/string/simple/show.yaml +1 -1
  32. data/markdown/readme/classes/struct/circular/show.md +1 -1
  33. data/markdown/readme/classes/struct/circular/show.yaml +1 -1
  34. data/markdown/readme/classes/struct/mixed/show.md +1 -1
  35. data/markdown/readme/classes/struct/mixed/show.yaml +1 -1
  36. data/markdown/readme/classes/struct/nested/show.md +1 -1
  37. data/markdown/readme/classes/struct/nested/show.yaml +1 -1
  38. data/markdown/readme/classes/struct/simple/show.md +1 -1
  39. data/markdown/readme/classes/struct/simple/show.yaml +1 -1
  40. data/markdown/readme/classes/symbol/simple/show.md +1 -1
  41. data/markdown/readme/classes/symbol/simple/show.yaml +1 -1
  42. data/markdown/readme/template.md +19 -0
  43. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb6a987450802b19bf3b2e7627185c7bbacee42f
4
- data.tar.gz: 22252b082a4f4c6073b39bcb018d25826a097a2d
3
+ metadata.gz: bcb726c44604dca3873eee267d8b1232bc55f637
4
+ data.tar.gz: 5072c0c19bdc5729bf0134a65b5f5df894a688d4
5
5
  SHA512:
6
- metadata.gz: 6892932fd1b46356cb94ea20e9ca6c259710c84d73742253dec38c63b6c12c7c2541dc6ba863cc91c21dc8f4496ce15e48662492cd0e90cac2a3d73ecdb3266d
7
- data.tar.gz: da0a37b7abacf2e4721902551e4b26edcaec71e3b3a129e633f3b2fbb8a53dcfe28bf214d09593695c78b5ccff03ad3a7f2944780943e6dcd7774a7fa4627f18
6
+ metadata.gz: e2fb59ddebe2f696de7728f28e9ec74b71f93baece609ee7d12783fd69c1ae7fad56bec37dd706d0032457b7cfe9e1bcef5022ac512e074baf8a9747c1d14806
7
+ data.tar.gz: c7241f9cfccef40479196a8c7c4def698ecef721adfd0157e086449ebada8ca60906d7e820cce4137809a35cd8c35d033974217275b3a3d157c51102e5e4ad36
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- debug_helper (1.0.0)
4
+ debug_helper (1.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -36,6 +36,25 @@ Others are treated as:
36
36
 
37
37
  - [Object](#object)
38
38
 
39
+ ## Class Method or Module Method?
40
+
41
+ Most examples in this documentation show use of the class method:
42
+
43
+ ```ruby
44
+ require 'debug_helper'
45
+ DebugHelper.show(obj, message)
46
+ ```
47
+
48
+ You can also choose to use the module method, ```putd``` (Thanks, [palkan](https://www.reddit.com/user/palkan)!), which looks a lot like ```puts```.
49
+
50
+ ```ruby
51
+ require 'debug_helper'
52
+ include DebugHelper::Putd
53
+ putd obj, message
54
+ ```
55
+
56
+ Just be sure to ```include DebugHelper::Putd```.
57
+
39
58
  ### Array
40
59
 
41
60
  #### Simple Array
@@ -55,7 +74,7 @@ The output shows details of the array.
55
74
  ```show.yaml```:
56
75
  ```yaml
57
76
  ---
58
- Array (name='My simple array' size=3):
77
+ Array (message='My simple array' size=3):
59
78
  Element 0: Fixnum 5
60
79
  Element 1: Fixnum 10
61
80
  Element 2: Fixnum 15
@@ -78,7 +97,7 @@ The output shows details of the array.
78
97
  ```show.yaml```:
79
98
  ```yaml
80
99
  ---
81
- Array (name='My mixed array' size=3):
100
+ Array (message='My mixed array' size=3):
82
101
  Element 0: Fixnum 0
83
102
  Element 1:
84
103
  String (size=3 encoding=UTF-8 ascii_only=true bytesize=3):
@@ -104,7 +123,7 @@ The output shows details of the arrays.
104
123
  ```show.yaml```:
105
124
  ```yaml
106
125
  ---
107
- Array (name='My nested arrays' size=3):
126
+ Array (message='My nested arrays' size=3):
108
127
  Element 0: Fixnum 0
109
128
  Element 1:
110
129
  Array (size=2):
@@ -138,7 +157,7 @@ The circular reference is not followed.
138
157
  ```show.yaml```:
139
158
  ```yaml
140
159
  ---
141
- Array (name='My circular arrays' size=1):
160
+ Array (message='My circular arrays' size=1):
142
161
  Element 0:
143
162
  Array (size=1):
144
163
  Element 0: Array [[[...]]]
@@ -162,7 +181,7 @@ The output shows details of the hash.
162
181
  ```show.yaml```:
163
182
  ```yaml
164
183
  ---
165
- Hash (size=3 name='My simple hash'):
184
+ Hash (size=3 message='My simple hash'):
166
185
  Pair 0:
167
186
  Key:
168
187
  Symbol (size=1 encoding=US-ASCII): :a
@@ -198,7 +217,7 @@ The output shows details of the hash.
198
217
  ```show.yaml```:
199
218
  ```yaml
200
219
  ---
201
- Hash (size=3 name='My mixed hash'):
220
+ Hash (size=3 message='My mixed hash'):
202
221
  Pair 0:
203
222
  Key:
204
223
  Symbol (size=1 encoding=US-ASCII): :a
@@ -242,7 +261,7 @@ The output shows details of the hashes.
242
261
  ```show.yaml```:
243
262
  ```yaml
244
263
  ---
245
- Hash (size=2 name='My nested hash'):
264
+ Hash (size=2 message='My nested hash'):
246
265
  Pair 0:
247
266
  Key:
248
267
  Symbol (size=1 encoding=US-ASCII): :a
@@ -293,7 +312,7 @@ The circular reference is not followed.
293
312
  ```show.yaml```:
294
313
  ```yaml
295
314
  ---
296
- Hash (size=1 name='My circular hashes'):
315
+ Hash (size=1 message='My circular hashes'):
297
316
  Pair 0:
298
317
  Key:
299
318
  Symbol (size=3 encoding=US-ASCII): :foo
@@ -324,7 +343,7 @@ The output shows details of the struct.
324
343
  ```show.yaml```:
325
344
  ```yaml
326
345
  ---
327
- MyStruct (name='My simple struct' size=3):
346
+ MyStruct (message='My simple struct' size=3):
328
347
  Member 0:
329
348
  Name: :a
330
349
  Value: Fixnum 0
@@ -354,7 +373,7 @@ The output shows details of the struct.
354
373
  ```show.yaml```:
355
374
  ```yaml
356
375
  ---
357
- MyStruct (name='My mixed struct' size=3):
376
+ MyStruct (message='My mixed struct' size=3):
358
377
  Member 0:
359
378
  Name: :a
360
379
  Value: Fixnum 0
@@ -390,7 +409,7 @@ The output shows details of the structs.
390
409
  ```show.yaml```:
391
410
  ```yaml
392
411
  ---
393
- MyStruct_0 (name='My nested struct' size=2):
412
+ MyStruct_0 (message='My nested struct' size=2):
394
413
  Member 0:
395
414
  Name: :a
396
415
  Value:
@@ -436,7 +455,7 @@ The circular reference is not followed.
436
455
  ```show.yaml```:
437
456
  ```yaml
438
457
  ---
439
- MyStruct (name='My circular struct' size=3):
458
+ MyStruct (message='My circular struct' size=3):
440
459
  Member 0:
441
460
  Name: :a
442
461
  Value:
@@ -477,7 +496,7 @@ The output shows details of the string.
477
496
  ```show.yaml```:
478
497
  ```yaml
479
498
  ---
480
- String (name='My simple string' size=11 encoding=UTF-8 ascii_only=true bytesize=11):
499
+ String (message='My simple string' size=11 encoding=UTF-8 ascii_only=true bytesize=11):
481
500
  - Lorem ipsum
482
501
  ```
483
502
 
@@ -501,7 +520,7 @@ The output shows details of the string.
501
520
  ```show.yaml```:
502
521
  ```yaml
503
522
  ---
504
- String (name='My multiline string' size=122 encoding=UTF-8 ascii_only=true bytesize=122):
523
+ String (message='My multiline string' size=122 encoding=UTF-8 ascii_only=true bytesize=122):
505
524
  - |
506
525
  Lorem Ipsum dolor sit amet,consectetur adipisicing elit,
507
526
  sed doeiusmod tempor incididunt ut laboreet dolore magna aliqua.
@@ -524,7 +543,7 @@ The output shows details of the symbol.
524
543
  ```show.yaml```:
525
544
  ```yaml
526
545
  ---
527
- Symbol (name='My symbol' size=11 encoding=US-ASCII): :lorem_ipsum
546
+ Symbol (message='My symbol' size=11 encoding=US-ASCII): :lorem_ipsum
528
547
  ```
529
548
  ### Object
530
549
 
@@ -548,7 +567,7 @@ The output shows details of the datetime.
548
567
 
549
568
  ```show.yaml```:
550
569
  ```yaml
551
- --- DateTime (name='My datetime') 2018-06-29T18:32:57-05:00
570
+ --- DateTime (message='My datetime') 2018-07-04T14:49:11-05:00
552
571
  ...
553
572
  ```
554
573
 
@@ -568,7 +587,7 @@ The output shows details of the range.
568
587
 
569
588
  ```show.yaml```:
570
589
  ```yaml
571
- --- Range (name='My range') 0..9
590
+ --- Range (message='My range') 0..9
572
591
  ...
573
592
  ```
574
593
 
@@ -588,6 +607,6 @@ The output shows details of the regexp.
588
607
 
589
608
  ```show.yaml```:
590
609
  ```yaml
591
- --- Regexp (name='My regexp') (?-mix:foo)
610
+ --- Regexp (message='My regexp') (?-mix:foo)
592
611
  ...
593
612
  ```
@@ -4,64 +4,72 @@ require 'debug_helper/version'
4
4
 
5
5
  class DebugHelper
6
6
 
7
+ module Putd
8
+
9
+ def putd(obj, message)
10
+ DebugHelper.show(obj, message)
11
+ end
12
+
13
+ end
14
+
7
15
  attr_accessor \
8
16
  :obj,
9
- :name,
17
+ :message,
10
18
  :object_ids
11
19
 
12
- def self.show(obj, name = obj.class)
13
- debug_helper = DebugHelper.new(obj, name)
14
- x = debug_helper.send(:_show, obj, name, info = {})
20
+ def self.show(obj, message = obj.class)
21
+ debug_helper = DebugHelper.new(obj, message)
22
+ x = debug_helper.send(:_show, obj, message, info = {})
15
23
  puts x.to_yaml
16
24
  end
17
25
 
18
26
  private
19
27
 
20
- def initialize(obj, name)
28
+ def initialize(obj, message)
21
29
  self.obj = obj
22
- self.name = name
30
+ self.message = message
23
31
  self.object_ids = []
24
32
  end
25
33
 
26
- def _show(obj, name, info)
34
+ def _show(obj, message, info)
27
35
  if object_ids.include?(obj.object_id)
28
- s = show_object(obj, name, info)
36
+ s = show_object(obj, message, info)
29
37
  else
30
38
  object_ids.push(obj.object_id)
31
39
  s = case
32
40
  when obj.kind_of?(Array)
33
- show_array(obj, name, info)
41
+ show_array(obj, message, info)
34
42
  when obj.kind_of?(Hash)
35
- show_hash(obj, name, info)
43
+ show_hash(obj, message, info)
36
44
  when obj.kind_of?(String)
37
- show_string(obj, name, info)
45
+ show_string(obj, message, info)
38
46
  when obj.kind_of?(Struct)
39
- show_struct(obj, name, info)
47
+ show_struct(obj, message, info)
40
48
  when obj.kind_of?(Symbol)
41
- show_symbol(obj, name, info)
49
+ show_symbol(obj, message, info)
42
50
  # when obj.kind_of?(Range)
43
51
  # when obj.kind_of?(Set)
44
52
  else
45
- show_object(obj, name, info)
53
+ show_object(obj, message, info)
46
54
  end
47
55
  end
48
56
  object_ids.pop
49
57
  s
50
58
  end
51
59
 
52
- def show_array(obj, name, info)
60
+ def show_array(obj, message, info)
53
61
  content = {}
54
62
  obj.each_with_index do |item, i|
55
63
  content.store("Element #{i}", _show(item, nil, {}))
56
64
  end
57
65
  attrs = {
58
- :name => name,
66
+ :message => message,
59
67
  :size => obj.size,
60
68
  }
61
69
  _show_item(obj.class.name, content, attrs, info)
62
70
  end
63
71
 
64
- def show_hash(obj, name, info)
72
+ def show_hash(obj, message, info)
65
73
  content = {}
66
74
  obj.each_with_index do |pair, i|
67
75
  key, value = *pair
@@ -72,19 +80,19 @@ class DebugHelper
72
80
  :size => obj.size,
73
81
  :default => obj.default,
74
82
  :default_proc => obj.default_proc,
75
- :name => name,
83
+ :message => message,
76
84
  }
77
85
  _show_item(obj.class.name, content, attrs, info)
78
86
  end
79
87
 
80
- def show_object(obj, name, info)
81
- name_info = name.nil? ? '' : " (name='#{name}')"
82
- "#{obj.class.name}#{name_info} #{obj}"
88
+ def show_object(obj, message, info)
89
+ message_info = message.nil? ? '' : " (message='#{message}')"
90
+ "#{obj.class.name}#{message_info} #{obj}"
83
91
  end
84
92
 
85
- def show_string(obj, name, info)
93
+ def show_string(obj, message, info)
86
94
  attrs = {
87
- :name => name,
95
+ :message => message,
88
96
  :size => obj.size,
89
97
  :encoding => obj.encoding,
90
98
  :ascii_only => obj.ascii_only?,
@@ -93,7 +101,7 @@ class DebugHelper
93
101
  _show_item(obj.class.name, [obj], attrs, info)
94
102
  end
95
103
 
96
- def show_struct(obj, name, info)
104
+ def show_struct(obj, message, info)
97
105
  content = {}
98
106
  i = 0
99
107
  obj.each_pair do |member|
@@ -103,15 +111,15 @@ class DebugHelper
103
111
  i += 1
104
112
  end
105
113
  attrs = {
106
- :name => name,
114
+ :message => message,
107
115
  :size => obj.size,
108
116
  }
109
117
  _show_item(obj.class.name, content, attrs, info)
110
118
  end
111
119
 
112
- def show_symbol(obj, name, info)
120
+ def show_symbol(obj, message, info)
113
121
  attrs = {
114
- :name => name,
122
+ :message => message,
115
123
  :size => obj.size,
116
124
  :encoding => obj.encoding,
117
125
  }
@@ -119,9 +127,9 @@ class DebugHelper
119
127
  end
120
128
 
121
129
  def _show_item(class_name, content, attrs, info)
122
- name = attrs[:name]
123
- unless name.nil?
124
- attrs[:name] = "'#{name}'"
130
+ message = attrs[:message]
131
+ unless message.nil?
132
+ attrs[:message] = "'#{message}'"
125
133
  end
126
134
  label = label(class_name, attrs)
127
135
  info.store(label, content)
@@ -137,18 +145,4 @@ class DebugHelper
137
145
  "#{class_name} (#{attrs_s})"
138
146
  end
139
147
 
140
- # def respond_to!(obj, method)
141
- # unless obj.respond_to?(method)
142
- # message = "Instance of #{obj.class.name} does not respond to :#{method}"
143
- # raise ArgumentError.new(message)
144
- # end
145
- # end
146
- #
147
- # def kind_of!(obj, klass)
148
- # unless obj.kind_of?(klass)
149
- # message = "Instance of #{obj.class.name} is not a kind of #{klass}"
150
- # raise ArgumentError.new(message)
151
- # end
152
- # end
153
-
154
148
  end
@@ -1,3 +1,3 @@
1
1
  class DebugHelper
2
- VERSION = "1.0.0"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -20,7 +20,7 @@ The circular reference is not followed.
20
20
  ```show.yaml```:
21
21
  ```yaml
22
22
  ---
23
- Array (name='My circular arrays' size=1):
23
+ Array (message='My circular arrays' size=1):
24
24
  Element 0:
25
25
  Array (size=1):
26
26
  Element 0: Array [[[...]]]
@@ -1,5 +1,5 @@
1
1
  ---
2
- Array (name='My circular arrays' size=1):
2
+ Array (message='My circular arrays' size=1):
3
3
  Element 0:
4
4
  Array (size=1):
5
5
  Element 0: Array [[[...]]]
@@ -15,7 +15,7 @@ The output shows details of the array.
15
15
  ```show.yaml```:
16
16
  ```yaml
17
17
  ---
18
- Array (name='My mixed array' size=3):
18
+ Array (message='My mixed array' size=3):
19
19
  Element 0: Fixnum 0
20
20
  Element 1:
21
21
  String (size=3 encoding=UTF-8 ascii_only=true bytesize=3):
@@ -1,5 +1,5 @@
1
1
  ---
2
- Array (name='My mixed array' size=3):
2
+ Array (message='My mixed array' size=3):
3
3
  Element 0: Fixnum 0
4
4
  Element 1:
5
5
  String (size=3 encoding=UTF-8 ascii_only=true bytesize=3):
@@ -15,7 +15,7 @@ The output shows details of the arrays.
15
15
  ```show.yaml```:
16
16
  ```yaml
17
17
  ---
18
- Array (name='My nested arrays' size=3):
18
+ Array (message='My nested arrays' size=3):
19
19
  Element 0: Fixnum 0
20
20
  Element 1:
21
21
  Array (size=2):
@@ -1,5 +1,5 @@
1
1
  ---
2
- Array (name='My nested arrays' size=3):
2
+ Array (message='My nested arrays' size=3):
3
3
  Element 0: Fixnum 0
4
4
  Element 1:
5
5
  Array (size=2):
@@ -15,7 +15,7 @@ The output shows details of the array.
15
15
  ```show.yaml```:
16
16
  ```yaml
17
17
  ---
18
- Array (name='My simple array' size=3):
18
+ Array (message='My simple array' size=3):
19
19
  Element 0: Fixnum 5
20
20
  Element 1: Fixnum 10
21
21
  Element 2: Fixnum 15
@@ -1,5 +1,5 @@
1
1
  ---
2
- Array (name='My simple array' size=3):
2
+ Array (message='My simple array' size=3):
3
3
  Element 0: Fixnum 5
4
4
  Element 1: Fixnum 10
5
5
  Element 2: Fixnum 15
@@ -20,7 +20,7 @@ The circular reference is not followed.
20
20
  ```show.yaml```:
21
21
  ```yaml
22
22
  ---
23
- Hash (size=1 name='My circular hashes'):
23
+ Hash (size=1 message='My circular hashes'):
24
24
  Pair 0:
25
25
  Key:
26
26
  Symbol (size=3 encoding=US-ASCII): :foo
@@ -1,5 +1,5 @@
1
1
  ---
2
- Hash (size=1 name='My circular hashes'):
2
+ Hash (size=1 message='My circular hashes'):
3
3
  Pair 0:
4
4
  Key:
5
5
  Symbol (size=3 encoding=US-ASCII): :foo
@@ -19,7 +19,7 @@ The output shows details of the hash.
19
19
  ```show.yaml```:
20
20
  ```yaml
21
21
  ---
22
- Hash (size=3 name='My mixed hash'):
22
+ Hash (size=3 message='My mixed hash'):
23
23
  Pair 0:
24
24
  Key:
25
25
  Symbol (size=1 encoding=US-ASCII): :a
@@ -1,5 +1,5 @@
1
1
  ---
2
- Hash (size=3 name='My mixed hash'):
2
+ Hash (size=3 message='My mixed hash'):
3
3
  Pair 0:
4
4
  Key:
5
5
  Symbol (size=1 encoding=US-ASCII): :a
@@ -24,7 +24,7 @@ The output shows details of the hashes.
24
24
  ```show.yaml```:
25
25
  ```yaml
26
26
  ---
27
- Hash (size=2 name='My nested hash'):
27
+ Hash (size=2 message='My nested hash'):
28
28
  Pair 0:
29
29
  Key:
30
30
  Symbol (size=1 encoding=US-ASCII): :a
@@ -1,5 +1,5 @@
1
1
  ---
2
- Hash (size=2 name='My nested hash'):
2
+ Hash (size=2 message='My nested hash'):
3
3
  Pair 0:
4
4
  Key:
5
5
  Symbol (size=1 encoding=US-ASCII): :a
@@ -15,7 +15,7 @@ The output shows details of the hash.
15
15
  ```show.yaml```:
16
16
  ```yaml
17
17
  ---
18
- Hash (size=3 name='My simple hash'):
18
+ Hash (size=3 message='My simple hash'):
19
19
  Pair 0:
20
20
  Key:
21
21
  Symbol (size=1 encoding=US-ASCII): :a
@@ -1,5 +1,5 @@
1
1
  ---
2
- Hash (size=3 name='My simple hash'):
2
+ Hash (size=3 message='My simple hash'):
3
3
  Pair 0:
4
4
  Key:
5
5
  Symbol (size=1 encoding=US-ASCII): :a
@@ -14,6 +14,6 @@ The output shows details of the datetime.
14
14
 
15
15
  ```show.yaml```:
16
16
  ```yaml
17
- --- DateTime (name='My datetime') 2018-06-29T17:20:16-05:00
17
+ --- DateTime (message='My datetime') 2018-07-04T14:49:11-05:00
18
18
  ...
19
19
  ```
@@ -1,2 +1,2 @@
1
- --- DateTime (name='My datetime') 2018-06-29T17:20:16-05:00
1
+ --- DateTime (message='My datetime') 2018-07-04T14:49:11-05:00
2
2
  ...
@@ -14,6 +14,6 @@ The output shows details of the range.
14
14
 
15
15
  ```show.yaml```:
16
16
  ```yaml
17
- --- Range (name='My range') 0..9
17
+ --- Range (message='My range') 0..9
18
18
  ...
19
19
  ```
@@ -1,2 +1,2 @@
1
- --- Range (name='My range') 0..9
1
+ --- Range (message='My range') 0..9
2
2
  ...
@@ -14,6 +14,6 @@ The output shows details of the regexp.
14
14
 
15
15
  ```show.yaml```:
16
16
  ```yaml
17
- --- Regexp (name='My regexp') (?-mix:foo)
17
+ --- Regexp (message='My regexp') (?-mix:foo)
18
18
  ...
19
19
  ```
@@ -1,2 +1,2 @@
1
- --- Regexp (name='My regexp') (?-mix:foo)
1
+ --- Regexp (message='My regexp') (?-mix:foo)
2
2
  ...
@@ -18,7 +18,7 @@ The output shows details of the string.
18
18
  ```show.yaml```:
19
19
  ```yaml
20
20
  ---
21
- String (name='My multiline string' size=122 encoding=UTF-8 ascii_only=true bytesize=122):
21
+ String (message='My multiline string' size=122 encoding=UTF-8 ascii_only=true bytesize=122):
22
22
  - |
23
23
  Lorem Ipsum dolor sit amet,consectetur adipisicing elit,
24
24
  sed doeiusmod tempor incididunt ut laboreet dolore magna aliqua.
@@ -1,5 +1,5 @@
1
1
  ---
2
- String (name='My multiline string' size=122 encoding=UTF-8 ascii_only=true bytesize=122):
2
+ String (message='My multiline string' size=122 encoding=UTF-8 ascii_only=true bytesize=122):
3
3
  - |
4
4
  Lorem Ipsum dolor sit amet,consectetur adipisicing elit,
5
5
  sed doeiusmod tempor incididunt ut laboreet dolore magna aliqua.
@@ -15,6 +15,6 @@ The output shows details of the string.
15
15
  ```show.yaml```:
16
16
  ```yaml
17
17
  ---
18
- String (name='My simple string' size=11 encoding=UTF-8 ascii_only=true bytesize=11):
18
+ String (message='My simple string' size=11 encoding=UTF-8 ascii_only=true bytesize=11):
19
19
  - Lorem ipsum
20
20
  ```
@@ -1,3 +1,3 @@
1
1
  ---
2
- String (name='My simple string' size=11 encoding=UTF-8 ascii_only=true bytesize=11):
2
+ String (message='My simple string' size=11 encoding=UTF-8 ascii_only=true bytesize=11):
3
3
  - Lorem ipsum
@@ -21,7 +21,7 @@ The circular reference is not followed.
21
21
  ```show.yaml```:
22
22
  ```yaml
23
23
  ---
24
- MyStruct (name='My circular struct' size=3):
24
+ MyStruct (message='My circular struct' size=3):
25
25
  Member 0:
26
26
  Name: :a
27
27
  Value:
@@ -1,5 +1,5 @@
1
1
  ---
2
- MyStruct (name='My circular struct' size=3):
2
+ MyStruct (message='My circular struct' size=3):
3
3
  Member 0:
4
4
  Name: :a
5
5
  Value:
@@ -16,7 +16,7 @@ The output shows details of the struct.
16
16
  ```show.yaml```:
17
17
  ```yaml
18
18
  ---
19
- MyStruct (name='My mixed struct' size=3):
19
+ MyStruct (message='My mixed struct' size=3):
20
20
  Member 0:
21
21
  Name: :a
22
22
  Value: Fixnum 0
@@ -1,5 +1,5 @@
1
1
  ---
2
- MyStruct (name='My mixed struct' size=3):
2
+ MyStruct (message='My mixed struct' size=3):
3
3
  Member 0:
4
4
  Name: :a
5
5
  Value: Fixnum 0
@@ -19,7 +19,7 @@ The output shows details of the structs.
19
19
  ```show.yaml```:
20
20
  ```yaml
21
21
  ---
22
- MyStruct_0 (name='My nested struct' size=2):
22
+ MyStruct_0 (message='My nested struct' size=2):
23
23
  Member 0:
24
24
  Name: :a
25
25
  Value:
@@ -1,5 +1,5 @@
1
1
  ---
2
- MyStruct_0 (name='My nested struct' size=2):
2
+ MyStruct_0 (message='My nested struct' size=2):
3
3
  Member 0:
4
4
  Name: :a
5
5
  Value:
@@ -16,7 +16,7 @@ The output shows details of the struct.
16
16
  ```show.yaml```:
17
17
  ```yaml
18
18
  ---
19
- MyStruct (name='My simple struct' size=3):
19
+ MyStruct (message='My simple struct' size=3):
20
20
  Member 0:
21
21
  Name: :a
22
22
  Value: Fixnum 0
@@ -1,5 +1,5 @@
1
1
  ---
2
- MyStruct (name='My simple struct' size=3):
2
+ MyStruct (message='My simple struct' size=3):
3
3
  Member 0:
4
4
  Name: :a
5
5
  Value: Fixnum 0
@@ -14,5 +14,5 @@ The output shows details of the symbol.
14
14
  ```show.yaml```:
15
15
  ```yaml
16
16
  ---
17
- Symbol (name='My symbol' size=11 encoding=US-ASCII): :lorem_ipsum
17
+ Symbol (message='My symbol' size=11 encoding=US-ASCII): :lorem_ipsum
18
18
  ```
@@ -1,2 +1,2 @@
1
1
  ---
2
- Symbol (name='My symbol' size=11 encoding=US-ASCII): :lorem_ipsum
2
+ Symbol (message='My symbol' size=11 encoding=US-ASCII): :lorem_ipsum
@@ -22,4 +22,23 @@ Others are treated as:
22
22
 
23
23
  - [Object](#object)
24
24
 
25
+ ## Class Method or Module Method?
26
+
27
+ Most examples in this documentation show use of the class method:
28
+
29
+ ```ruby
30
+ require 'debug_helper'
31
+ DebugHelper.show(obj, message)
32
+ ```
33
+
34
+ You can also choose to use the module method, ```putd``` (Thanks, [palkan](https://www.reddit.com/user/palkan)!), which looks a lot like ```puts```.
35
+
36
+ ```ruby
37
+ require 'debug_helper'
38
+ include DebugHelper::Putd
39
+ putd obj, message
40
+ ```
41
+
42
+ Just be sure to ```include DebugHelper::Putd```.
43
+
25
44
  @[:markdown](class_inclusions.md)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debug_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - burdettelamar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-30 00:00:00.000000000 Z
11
+ date: 2018-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler