object_inspector 0.8.1 → 0.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7c455c7ca56db68fa7815ffa478fcc2d408a2d04c287444d761c6e6856e4a64
4
- data.tar.gz: bee632f0532c60ccdab9a6ef134179b69df8ef8df1ae4ad2e7e264c6a7199eb1
3
+ metadata.gz: 50466d066a40b772c3d98ff85d1be9934a3011e9699261de12da2b620bec1785
4
+ data.tar.gz: 6deb6b097b7ee1c6d553754242ecbcc0683b3768c5906c139c279a6e07e21da4
5
5
  SHA512:
6
- metadata.gz: 5001b8e84a58a32f3319e513f9d6400529ef460a9d98815bb1736ade07efa790148f0cec128299dc4fea789d2ea093ac83109223a0984499676e114d975bd44d
7
- data.tar.gz: cd4e03505e28ed7767c89bc49b752e6d001c3c62372ae9179904e878181d2d281489e74699b5cc2e78c4f55776c8ffe6dedb924a6aad03309023d553157dd868
6
+ metadata.gz: fccec790066ab69fad5c25d737c04b3c5698860d6acca5bc828e0be0a1186260060ad328c183dffc58012c9461405259de1ffb27b763e370df1cc48aa08459d4
7
+ data.tar.gz: a20c43a5d28088cd5ca7c0da08e1c456f8d4e0433faf7a552401855b66267c8b596e1beb7885ec9a80e829ac9b2523287ef2e3139122ca4b961d3cc54a0072ab
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Object Inspector takes Object#inspect to the next level. Specify any combination of identification attributes, flags, issues, info, and/or a name along with an optional, self-definable scope option to represent objects. Great for the console, logging, etc.
7
7
 
8
- Why? Because object inspection code should be uniform, easy to build, and its output should be easy to read!
8
+ Why? Because object inspection code should be uniform and easy to build, and its output should be easy to read! Consistency improves readability.
9
9
 
10
10
  If you'd like to just jump into an example: [Full Example](#full-example).
11
11
 
@@ -19,11 +19,15 @@ gem "object_inspector"
19
19
 
20
20
  And then execute:
21
21
 
22
- $ bundle
22
+ ```sh
23
+ $ bundle
24
+ ```
23
25
 
24
26
  Or install it yourself:
25
27
 
26
- $ gem install object_inspector
28
+ ```sh
29
+ $ gem install object_inspector
30
+ ```
27
31
 
28
32
  ## Compatibility
29
33
 
@@ -42,19 +46,19 @@ gem "object_inspector", "0.6.3"
42
46
  For Ruby 3.1 support, install object_inspector gem version 0.7.0.
43
47
 
44
48
  ```ruby
45
- gem "object_inspector", "0.6.3"
49
+ gem "object_inspector", "0.7.0"
46
50
  ```
47
51
 
48
52
  Object Inspector has no other dependencies.
49
53
 
50
54
  ## Configuration
51
55
 
52
- Global/default values for Object Inspector can be configured via the ObjectInspector::Configuration object.
53
-
54
- _Note: In a Rails app, the following would go in e.g. `config/initializers/object_inspector.rb`_
56
+ Global/default values for Object Inspector can be configured via the [ObjectInspector::Configuration] object.
55
57
 
56
58
  ```ruby
57
- # Default values are shown.
59
+ # config/initializers/object_inspector.rb
60
+
61
+ # Default values are shown. Customize to your liking.
58
62
  ObjectInspector.configure do |config|
59
63
  config.formatter_class = ObjectInspector::TemplatingFormatter
60
64
  config.inspect_method_prefix = "inspect"
@@ -71,7 +75,7 @@ end
71
75
 
72
76
  ## Usage
73
77
 
74
- Given, an object of any type, call ObjectInspector::Inspector.inspect.
78
+ Pass an object of any type into `ObjectInspector::Inspector.inspect`.
75
79
 
76
80
  ```ruby
77
81
  class MyObject
@@ -83,11 +87,11 @@ end
83
87
  MyObject.new.inspect # => "<MyObject>"
84
88
  ```
85
89
 
86
- See also [Helper Usage](#helper-usage) for an even simpler usage option.
90
+ See: [Helper Usage](#helper-usage) for simpler usage.
87
91
 
88
92
  ### Output Customization
89
93
 
90
- Use the `identification`, `flags`, `info`, and/or `name` options to customize inspect output.
94
+ Use the `identification`, `flags`, `issues`, `info`, and/or `name` options to customize inspect output.
91
95
 
92
96
  ```ruby
93
97
  class MyObject
@@ -96,15 +100,17 @@ class MyObject
96
100
  self,
97
101
  identification: "My Object",
98
102
  flags: "FLAG1 / FLAG2",
103
+ issues: "ISSUE1",
99
104
  info: "INFO",
100
105
  name: "NAME")
101
106
  end
102
107
  end
103
108
 
104
- MyObject.new.inspect # => "<My Object(FLAG1 / FLAG2) INFO :: NAME>"
109
+ MyObject.new.inspect
110
+ # => "<My Object(FLAG1 / FLAG2) !!ISSUE1!! INFO :: NAME>"
105
111
  ```
106
112
 
107
- Or, define `inspect_identification`, `inspect_flags`, `inspect_info`, and/or `inspect_name` (or `display_name`) as either public or private methods on Object.
113
+ Or, define `inspect_identification`, `inspect_flags`, `inspect_issues`, `inspect_info`, and/or `inspect_name` (or `display_name`) as either public or private methods on Object.
108
114
 
109
115
  ```ruby
110
116
  class MyObject
@@ -114,11 +120,11 @@ class MyObject
114
120
 
115
121
  private
116
122
 
117
- def inspect_identification; "My Object" end
118
- def inspect_flags; "FLAG1 / FLAG2" end
119
- def inspect_issues; "ISSUE1 | ISSUE2" end
120
- def inspect_info; "INFO" end
121
- def inspect_name; "NAME" end # Or: def display_name; "NAME" end
123
+ def inspect_identification = "My Object"
124
+ def inspect_flags = "FLAG1 / FLAG2"
125
+ def inspect_issues = "ISSUE1 | ISSUE2"
126
+ def inspect_info = "INFO"
127
+ def inspect_name = "NAME" # Or: def display_name = "NAME"
122
128
  end
123
129
 
124
130
  MyObject.new.inspect
@@ -127,7 +133,7 @@ MyObject.new.inspect
127
133
 
128
134
  ## Helper Usage
129
135
 
130
- To save some typing, include ObjectInspector::InspectHelper into an object and ObjectInspector::Inspector.inspect will be called on `self` automatically.
136
+ To save some typing, include ObjectInspector::InspectHelper into an object and `ObjectInspector::Inspector.inspect` will be called on `self` automatically.
131
137
 
132
138
  ```ruby
133
139
  class MyObject
@@ -164,11 +170,11 @@ class MyObject
164
170
 
165
171
  private
166
172
 
167
- def inspect_identification; "My Object" end
168
- def inspect_flags; "FLAG1 / FLAG2" end
169
- def inspect_issues; "ISSUE1 | ISSUE2" end
170
- def inspect_info; "INFO" end
171
- def inspect_name; "NAME" end # Or: def display_name; "NAME" end
173
+ def inspect_identification = "My Object"
174
+ def inspect_flags = "FLAG1 / FLAG2"
175
+ def inspect_issues = "ISSUE1 | ISSUE2"
176
+ def inspect_info = "INFO"
177
+ def inspect_name = "NAME" # Or: def display_name = "NAME"
172
178
  end
173
179
 
174
180
  MyObject.new.inspect
@@ -192,15 +198,16 @@ my_object.inspect(scope: <scope_name>)
192
198
 
193
199
  Options:
194
200
 
195
- - `:self` (Default) -- Is meant to confine object interrogation to self (don't interrogate neighboring objects).
196
- - `:all` -- Is meant to match on all scopes, regardless of their name.
197
- - `<custom>` -- Anything else that makes sense for the object to key on.
201
+ - `:self` (Default)--Is meant to confine object interrogation to self (don't interrogate neighboring objects).
202
+ - `:all`--Is meant to match on all scopes, regardless of their name.
203
+ - `<custom>`--Anything else that makes sense for the object to key on.
198
204
 
199
205
  ```ruby
200
206
  scope = ObjectInspector::Scope.new
201
- scope.self? # => true
202
- scope.verbose? # => false
203
- scope.complex? # => false
207
+ scope.self? # => true
208
+ scope.verbose? # => false
209
+ scope.complex? # => false
210
+ scope.<anything>? # => false
204
211
  ```
205
212
 
206
213
  #### Multiple Scope Names
@@ -223,6 +230,7 @@ scope = ObjectInspector::Scope.new(:all)
223
230
  scope.self? # => true
224
231
  scope.verbose? # => true
225
232
  scope.complex? # => true
233
+ scope.all? # => true
226
234
  ```
227
235
 
228
236
  ### Scope blocks
@@ -240,20 +248,19 @@ scope.complex? { "MATCH" } # => "*"
240
248
  ObjectInspector::Scope also offers helper methods for uniformly joining inspect elements:
241
249
 
242
250
  ```ruby
243
- join_name # Joins name parts with ` - ` by default
244
- join_flags # Joins flags with ` / ` by default
245
- join_info # Joins info items with ` | ` by default
251
+ join_name # Joins name parts with ` - ` by default
252
+ join_flags # Joins flags with ` / ` by default
253
+ join_issues # Joins issues with ` | ` by default
254
+ join_info # Joins info items with ` | ` by default
246
255
  ```
247
256
 
248
257
  For example:
249
258
 
250
259
  ```ruby
251
- scope = ObjectInspector::Scope.new(:verbose)
252
- scope.join_name([1, 2, 3]) # => "1 - 2 - 3"
253
- scope.join_name([1, 2, 3, nil]) # => "1 - 2 - 3"
254
- scope.join_flags([1, 2, 3]) # => "1 / 2 / 3"
260
+ scope = ObjectInspector::Scope.new(:all)
261
+ scope.join_name([1, 2, 3, nil]) # => "1 - 2 - 3"
255
262
  scope.join_flags([1, 2, 3, nil]) # => "1 / 2 / 3"
256
- scope.join_info([1, 2, 3]) # => "1 | 2 | 3"
263
+ scope.join_issues([1, 2, 3, nil]) # => "1 | 2 | 3"
257
264
  scope.join_info([1, 2, 3, nil]) # => "1 | 2 | 3"
258
265
  ```
259
266
 
@@ -272,11 +279,11 @@ class MyObject
272
279
  end
273
280
 
274
281
  def associated_object1
275
- OpenStruct.new(flags: "AO1_FLAG1")
282
+ Data.define(:flags)["AO1_FLAG1"]
276
283
  end
277
284
 
278
285
  def associated_object2
279
- OpenStruct.new(flags: "AO2_FLAG1")
286
+ Data.define(:flags)["AO2_FLAG1"]
280
287
  end
281
288
 
282
289
  # Or `def inspect_name`
@@ -304,8 +311,11 @@ class MyObject
304
311
  scope.join_flags(flags)
305
312
  end
306
313
 
307
- def inspect_issues
308
- "!!WARNING!!"
314
+ def inspect_issues(scope:)
315
+ scope.join_issues([
316
+ "I1",
317
+ scope.verbose? { "VI2" },
318
+ ])
309
319
  end
310
320
 
311
321
  def inspect_info(scope:)
@@ -319,37 +329,40 @@ end
319
329
 
320
330
  my_object = MyObject.new("Name")
321
331
 
332
+ my_object.inspect
333
+ # => "<MyObject[2](DEFAULT_FLAG / *) !!I1 | *!! Default Info | * :: Name>"
334
+
335
+ my_object.inspect(scope: :self)
336
+ # => "<MyObject[2](DEFAULT_FLAG / *) !!I1 | *!! Default Info | * :: Name>"
337
+
322
338
  my_object.inspect(scope: :complex)
323
- # => "<MyObject[a2:2](DEFAULT_FLAG / *) !!!!WARNING!!!! Default Info | Complex Info | * :: Name>"
339
+ # => "<MyObject[2](DEFAULT_FLAG / *) !!I1 | *!! Default Info | Complex Info | * :: Name>"
324
340
 
325
341
  my_object.inspect(scope: :verbose)
326
- # => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!!!WARNING!!!! Default Info | Verbose Info :: Name>"
342
+ # => "<MyObject[2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!I1 | VI2!! Default Info | Verbose Info :: Name>"
327
343
 
328
344
  my_object.inspect(scope: %i[self complex verbose])
329
- # => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!!!WARNING!!!! Default Info | Complex Info | Verbose Info :: Name>"
345
+ # => "<MyObject[2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!I1 | VI2!! Default Info | Complex Info | Verbose Info :: Name>"
330
346
 
331
347
  my_object.inspect(scope: :all)
332
- # => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!!!WARNING!!!! Default Info | Complex Info | Verbose Info :: Name>"
333
-
334
- my_object.inspect
335
- # => "<MyObject[a2:2](DEFAULT_FLAG / *) !!!!WARNING!!!! Default Info | * :: Name>"
348
+ # => "<MyObject[2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!I1 | VI2!! Default Info | Complex Info | Verbose Info :: Name>"
336
349
 
337
350
  ObjectInspector.configuration.default_scope = :complex
338
351
  my_object.inspect
339
- # => "<MyObject[a2:2](DEFAULT_FLAG / *) !!!!WARNING!!!! Default Info | Complex Info | * :: Name>"
352
+ # => "<MyObject[2](DEFAULT_FLAG / *) !!I1 | *!! Default Info | Complex Info | * :: Name>"
340
353
 
341
354
  ObjectInspector.configuration.default_scope = %i[self complex verbose]
342
355
  my_object.inspect
343
- # => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!!!WARNING!!!! Default Info | Complex Info | Verbose Info :: Name>"
356
+ # => "<MyObject[2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!I1 | VI2!! Default Info | Complex Info | Verbose Info :: Name>"
344
357
 
345
358
  ObjectInspector.configuration.default_scope = :all
346
359
  my_object.inspect
347
- # => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!!!WARNING!!!! Default Info | Complex Info | Verbose Info :: Name>"
360
+ # => "<MyObject[2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!I1 | VI2!! Default Info | Complex Info | Verbose Info :: Name>"
348
361
  ```
349
362
 
350
363
  ## Wrapped Objects
351
364
 
352
- If the Object being inspected wraps another object -- i.e. defines #to_model and #to_model returns an object other than self -- the inspect output will re-inspect the wrapped object. The wrapper points to the wrapped object with an arrow (⇨).
365
+ If the Object being inspected wraps another object--i.e. defines #to_model and #to_model returns an object other than self--the inspect output will re-inspect the wrapped object. The wrapper points to the wrapped object with an arrow (⇨).
353
366
 
354
367
  ```ruby
355
368
  class MyWrapperObject
@@ -361,7 +374,7 @@ class MyWrapperObject
361
374
 
362
375
  private
363
376
 
364
- def inspect_flags; "WRAPPER_FLAG1" end
377
+ def inspect_flags = "WRAPPER_FLAG1"
365
378
  end
366
379
 
367
380
  class MyWrappedObject
@@ -369,8 +382,8 @@ class MyWrappedObject
369
382
 
370
383
  private
371
384
 
372
- def inspect_flags; "FLAG1 / FLAG2" end
373
- def inspect_info; "INFO" end
385
+ def inspect_flags = "FLAG1 / FLAG2"
386
+ def inspect_info = "INFO"
374
387
  end
375
388
 
376
389
  MyWrapperObject.new.inspect
@@ -424,10 +437,10 @@ class MyWrappedObject
424
437
 
425
438
  private
426
439
 
427
- def inspect_flags; "FLAG1" end
428
- def inspect_info; "INFO" end
429
- def inspect_issues; "ISSUE1" end
430
- def inspect_name; "NAME" end
440
+ def inspect_flags = "FLAG1"
441
+ def inspect_info = "INFO"
442
+ def inspect_issues = "ISSUE1"
443
+ def inspect_name = "NAME"
431
444
  end
432
445
 
433
446
  MyDelegatingWrapperObject.new(MyWrappedObject.new).inspect
@@ -442,10 +455,10 @@ When passed as an option (as opposed to being called via an Object-defined metho
442
455
  class MyObject
443
456
  include ObjectInspector::InspectorsHelper
444
457
 
445
- def my_method1; "Result1" end
446
- def my_method2; "Result2" end
458
+ def my_method1 = "Result1"
459
+ def my_method2 = "Result2"
447
460
 
448
- def inspect_info; :my_method2 end
461
+ def inspect_info = :my_method2
449
462
  end
450
463
 
451
464
  MyObject.new.inspect(info: "my_method1") # => "<MyObject my_method1>"
@@ -461,17 +474,18 @@ Pass `nil` to any inspect method type to not display it:
461
474
  class MyObject
462
475
  include ObjectInspector::InspectorsHelper
463
476
 
464
- def inspect_identification; "My Object" end
465
- def inspect_info; "INFO" end
466
- def inspect_flags; "FLAG1" end
467
- def inspect_issues; "ISSUE1" end
477
+ def inspect_identification = "My Object"
478
+ def inspect_info = "INFO"
479
+ def inspect_flags = "FLAG1"
480
+ def inspect_issues = "ISSUE1"
481
+ def inspect_name = "NAME"
468
482
  end
469
483
 
470
484
  MyObject.new.inspect
471
- # => "<My Object(FLAG1) !!ISSUE1!! INFO>"
485
+ # => "<My Object(FLAG1) !!ISSUE1!! INFO :: NAME>"
472
486
  MyObject.new.inspect(info: nil, flags: nil, issues: nil)
473
- # => "<My Object>"
474
- MyObject.new.inspect(identification: nil, info: nil, flags: nil, issues: nil)
487
+ # => "<My Object :: NAME>"
488
+ MyObject.new.inspect(identification: nil, info: nil, flags: nil, issues: nil, name: nil)
475
489
  # => "<MyObject>"
476
490
  ```
477
491
 
@@ -490,11 +504,12 @@ class MyObject
490
504
  include ObjectInspector::InspectorsHelper
491
505
 
492
506
  def inspect
493
- super(formatter: MyCustomFormatter,
494
- identification: "IDENTIFICATION",
495
- flags: "FLAG1 / FLAG2",
496
- info: "INFO",
497
- name: "NAME")
507
+ super(
508
+ formatter: MyCustomFormatter,
509
+ identification: "IDENTIFICATION",
510
+ flags: "FLAG1 / FLAG2",
511
+ info: "INFO",
512
+ name: "NAME")
498
513
  end
499
514
  end
500
515
 
@@ -529,10 +544,10 @@ class MyObject
529
544
  identify(:my_method1, :my_method2)
530
545
  end
531
546
 
532
- def inspect_flags; "FLAG1 / FLAG2" end
533
- def inspect_issues; "ISSUE1 | ISSUE2" end
534
- def inspect_info; "INFO" end
535
- def inspect_name; "NAME" end
547
+ def inspect_flags = "FLAG1 / FLAG2"
548
+ def inspect_issues = "ISSUE1 | ISSUE2"
549
+ def inspect_info = "INFO"
550
+ def inspect_name = "NAME"
536
551
  end
537
552
 
538
553
  MyObject.new.inspect
@@ -543,51 +558,59 @@ MyObject.new.inspect
543
558
 
544
559
  ### Benchmarking Object Inspector
545
560
 
546
- ObjectInspetor is ~4x slower than Ruby's default inspect.
561
+ ObjectInspetor is ~2.75x slower than Ruby's default inspect, in Ruby v3.4.
547
562
 
548
563
  Performance of Object Inspector can be tested by playing the [Object Inspector Benchmarking Script](https://github.com/pdobb/object_inspector/blob/master/script/benchmarking/object_inspector.rb) in the IRB console for this gem.
549
564
 
550
565
  ```ruby
551
566
  load "script/benchmarking/object_inspector.rb"
567
+ # Reporting for: Ruby v3.4.2
568
+ #
569
+ # == Averaged =============================================================
570
+ # ...
571
+ #
552
572
  # Comparison:
553
- # Ruby: 30382.2 i/s
554
- # ObjectInspector::Inspector: 7712.2 i/s - 3.94x slower
573
+ # Ruby: 58957.2 i/s
574
+ # ObjectInspector::Inspector: 21416.6 i/s - 2.75x slower
575
+ # == Done
555
576
  ```
556
577
 
557
578
  ### Benchmarking Formatters
558
579
 
559
- [ObjectInspector::TemplatingFormatter] -- which is the default Formatter -- outperforms [ObjectInspector::CombiningFormatter] by about 30% on average.
580
+ [ObjectInspector::TemplatingFormatter]--which is the default Formatter--outperforms [ObjectInspector::CombiningFormatter] by about 30% on average.
560
581
 
561
582
  Performance of Formatters can be tested by playing the [Formatters Benchmarking Scripts](https://github.com/pdobb/object_inspector/blob/master/script/benchmarking/formatters.rb) in the IRB console for this gem.
562
583
 
563
584
  ```ruby
564
585
  load "script/benchmarking/formatters.rb"
586
+ # Reporting for: Ruby v3.4.2
587
+ #
565
588
  # == Averaged =============================================================
566
589
  # ...
567
590
  #
568
591
  # Comparison:
569
- # ObjectInspector::TemplatingFormatter: 45725.3 i/s
570
- # ObjectInspector::CombiningFormatter: 34973.9 i/s - 1.31x slower
571
- #
592
+ # ObjectInspector::TemplatingFormatter: 65856.3 i/s
593
+ # ObjectInspector::CombiningFormatter: 60920.0 i/s - 1.08x slower
572
594
  # == Done
573
595
  ```
574
596
 
575
597
  #### Benchmarking Custom Formatters
576
598
 
577
- Custom Formatters may be similarly gauged for comparison by adding them to the `custom_formatter_klasses` array before playing the script.
599
+ Custom Formatters may be similarly gauged for comparison by putting them into a constant `CUSTOM_FORMATTER_CLASSES` before playing the script in the IRB console for this gem.
578
600
 
579
601
  ```ruby
580
- custom_formatter_klasses = [MyCustomFormatter]
602
+ CUSTOM_FORMATTER_CLASSES = [MyCustomFormatter]
581
603
 
582
- play script/benchmarking/formatters.rb
604
+ load "script/benchmarking/formatters.rb"
605
+ # Reporting for: Ruby v3.4.2
606
+ #
583
607
  # == Averaged =============================================================
584
608
  # ...
585
609
  #
586
610
  # Comparison:
587
- # MyCustomFormatter: 52001.2 i/s
588
- # ObjectInspector::TemplatingFormatter: 49854.2 i/s - same-ish: difference falls within error
589
- # ObjectInspector::CombiningFormatter: 38963.5 i/s - 1.33x slower
590
- #
611
+ # MyCustomFormatter: 74227.7 i/s
612
+ # ObjectInspector::TemplatingFormatter: 66148.5 i/s - 1.12x slower
613
+ # ObjectInspector::CombiningFormatter: 63289.7 i/s - 1.17x slower
591
614
  # == Done
592
615
  ```
593
616
 
@@ -601,13 +624,13 @@ To install this gem onto your local machine, run `bundle exec rake install`.
601
624
 
602
625
  To test this gem:
603
626
 
604
- ```bash
627
+ ```sh
605
628
  rake
606
629
  ```
607
630
 
608
631
  #### Linters
609
632
 
610
- ```bash
633
+ ```sh
611
634
  rubocop
612
635
 
613
636
  reek
@@ -16,7 +16,7 @@ class ObjectInspector::BaseFormatter
16
16
  #
17
17
  # @return [String]
18
18
  def call
19
- raise NotImplementedError
19
+ raise(NotImplementedError)
20
20
  end
21
21
 
22
22
  # Delegates to {Inspector#wrapped_object_inspection_result}.
@@ -38,6 +38,7 @@ class ObjectInspector::CombiningFormatter < ObjectInspector::BaseFormatter
38
38
  [
39
39
  build_identification_string,
40
40
  build_flags_string,
41
+ build_issues_string,
41
42
  build_info_string,
42
43
  build_name_string,
43
44
  ].compact
@@ -51,6 +52,10 @@ class ObjectInspector::CombiningFormatter < ObjectInspector::BaseFormatter
51
52
  "(#{flags.to_s.upcase})" if flags
52
53
  end
53
54
 
55
+ def build_issues_string
56
+ " !!#{issues.to_s.upcase}!!" if issues
57
+ end
58
+
54
59
  def build_info_string
55
60
  " #{info}" if info
56
61
  end
@@ -36,7 +36,7 @@ class ObjectInspector::Inspector
36
36
  **kwargs)
37
37
  @object = object
38
38
  @scope = ObjectInspector::Conversions.Scope(scope)
39
- @formatter_klass = formatter
39
+ @formatter_class = formatter
40
40
  @kwargs = kwargs
41
41
  end
42
42
 
@@ -57,7 +57,7 @@ class ObjectInspector::Inspector
57
57
  self.class.inspect(
58
58
  extract_wrapped_object,
59
59
  scope: @scope,
60
- formatter: @formatter_klass,
60
+ formatter: @formatter_class,
61
61
  kwargs: @kwargs)
62
62
  end
63
63
 
@@ -112,7 +112,7 @@ class ObjectInspector::Inspector
112
112
  private
113
113
 
114
114
  def formatter
115
- @formatter_klass.new(self)
115
+ @formatter_class.new(self)
116
116
  end
117
117
 
118
118
  # @return [String] if `key` is found in {#kwargs} or if {#object} responds to
@@ -8,7 +8,7 @@ module ObjectInspector::InspectorsHelper
8
8
  # passing it the passed in `kwargs` (keyword arguments).
9
9
  #
10
10
  # @return [String]
11
- def inspect(object = self, ...)
12
- ObjectInspector::Inspector.inspect(object, ...)
11
+ def inspect(object = self, **)
12
+ ObjectInspector::Inspector.inspect(object, **)
13
13
  end
14
14
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module ObjectInspector
4
4
  # The current ObjectInspector gem version.
5
- VERSION = "0.8.1"
5
+ VERSION = "0.9.0"
6
6
  end
@@ -51,7 +51,7 @@ module ObjectInspector
51
51
 
52
52
  def formatter_class=(value)
53
53
  unless value.is_a?(Class)
54
- raise TypeError, "Formatter must be a Class constant"
54
+ raise(TypeError, "Formatter must be a Class constant")
55
55
  end
56
56
 
57
57
  @formatter_class = value
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: object_inspector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul DobbinSchmaltz
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-04 00:00:00.000000000 Z
10
+ date: 2025-03-23 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: benchmark-ips
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  requirements: []
113
- rubygems_version: 3.6.2
113
+ rubygems_version: 3.6.6
114
114
  specification_version: 4
115
115
  summary: Object Inspector builds uniformly formatted inspect output with customizable
116
116
  amounts of detail.