object_inspector 0.4.0 → 0.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.
- checksums.yaml +4 -4
- data/.rubocop +4 -0
- data/.rubocop.yml +145 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +46 -6
- data/README.md +38 -22
- data/Rakefile +1 -1
- data/lib/object_inspector/conversions.rb +2 -3
- data/lib/object_inspector/formatters/base_formatter.rb +8 -2
- data/lib/object_inspector/formatters/combining_formatter.rb +5 -3
- data/lib/object_inspector/formatters/templating_formatter.rb +162 -62
- data/lib/object_inspector/inspector.rb +16 -8
- data/lib/object_inspector/object_interrogator.rb +1 -1
- data/lib/object_inspector/scope.rb +23 -5
- data/lib/object_inspector/version.rb +1 -1
- data/lib/object_inspector.rb +21 -4
- data/object_inspector.gemspec +13 -11
- data/scripts/benchmarking/formatters.rb +3 -5
- data/scripts/benchmarking/object_inspector.rb +1 -2
- metadata +52 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f4c63d6d3fafd3a58a9d2b5044b4d815e4778b762aa5ed38702e4ec79fcd4ec
|
4
|
+
data.tar.gz: 7aebf8ecc7b5ec9de2cb0b95d11b70cfdc1f91e69d306aa930843c90f7803571
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2552d039748335690f1d3e95382232e644d875c43823d7bbb81cc5acaff3437549027e6119ee8dc1236e270bdea96e26ebd0130329d6e149bb01feac67d6c95
|
7
|
+
data.tar.gz: 3414d335667867d81c96701fd07bad0b71025f750c127db218915cb5e8f23116619fcfb347494aa9bc1b07b9fa5bf9056af0db82871eb029013c0417cb1bb387
|
data/.rubocop
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
# AllCops:
|
2
|
+
|
3
|
+
Layout/ClassStructure:
|
4
|
+
Enabled: true
|
5
|
+
Categories:
|
6
|
+
module_inclusion:
|
7
|
+
- extend
|
8
|
+
- include
|
9
|
+
- prepend
|
10
|
+
attributes:
|
11
|
+
- attr_accessor
|
12
|
+
- attr_reader
|
13
|
+
- attr_writer
|
14
|
+
ExpectedOrder:
|
15
|
+
- constants
|
16
|
+
- module_inclusion
|
17
|
+
- attributes
|
18
|
+
- public_class_methods
|
19
|
+
- initializer
|
20
|
+
- public_methods
|
21
|
+
- predicates
|
22
|
+
- protected_methods
|
23
|
+
- private_methods
|
24
|
+
|
25
|
+
Layout/DotPosition:
|
26
|
+
EnforcedStyle: trailing
|
27
|
+
|
28
|
+
Layout/EmptyLineAfterGuardClause:
|
29
|
+
Enabled: true
|
30
|
+
|
31
|
+
Layout/EndOfLine:
|
32
|
+
EnforcedStyle: lf
|
33
|
+
|
34
|
+
Layout/FirstParameterIndentation:
|
35
|
+
EnforcedStyle: consistent_relative_to_receiver
|
36
|
+
|
37
|
+
Layout/IndentArray:
|
38
|
+
EnforcedStyle: consistent
|
39
|
+
|
40
|
+
Layout/IndentHash:
|
41
|
+
EnforcedStyle: consistent
|
42
|
+
|
43
|
+
Layout/MultilineAssignmentLayout:
|
44
|
+
Enabled: true
|
45
|
+
|
46
|
+
Layout/MultilineMethodCallBraceLayout:
|
47
|
+
EnforcedStyle: same_line
|
48
|
+
|
49
|
+
Layout/MultilineMethodCallIndentation:
|
50
|
+
EnforcedStyle: indented_relative_to_receiver
|
51
|
+
|
52
|
+
Layout/MultilineMethodDefinitionBraceLayout:
|
53
|
+
EnforcedStyle: same_line
|
54
|
+
|
55
|
+
Layout/MultilineOperationIndentation:
|
56
|
+
Enabled: false # Waiting for e.g. `indented_relative_to_receiver`.
|
57
|
+
|
58
|
+
Lint/AmbiguousOperator:
|
59
|
+
Enabled: false # Conflicts with other rules.
|
60
|
+
|
61
|
+
Lint/AmbiguousRegexpLiteral:
|
62
|
+
Enabled: false # Conflicts with other rules.
|
63
|
+
|
64
|
+
Lint/Void:
|
65
|
+
CheckForMethodsWithNoSideEffects: true
|
66
|
+
|
67
|
+
Metrics/BlockLength:
|
68
|
+
ExcludedMethods:
|
69
|
+
- new
|
70
|
+
- describe # Tests
|
71
|
+
- context # Tests
|
72
|
+
- ips # Benchmarking
|
73
|
+
|
74
|
+
Metrics/ClassLength:
|
75
|
+
Exclude:
|
76
|
+
- "test/**/*"
|
77
|
+
- "lib/object_inspector/formatters/templating_formatter.rb"
|
78
|
+
|
79
|
+
Metrics/LineLength:
|
80
|
+
Max: 80
|
81
|
+
Exclude:
|
82
|
+
- "test/**/*"
|
83
|
+
- "object_inspector.gemspec"
|
84
|
+
|
85
|
+
Naming/UncommunicativeMethodParamName:
|
86
|
+
AllowedNames:
|
87
|
+
- a
|
88
|
+
- b
|
89
|
+
|
90
|
+
Style/Alias:
|
91
|
+
EnforcedStyle: prefer_alias_method
|
92
|
+
|
93
|
+
Style/BlockDelimiters:
|
94
|
+
Enabled: false # Reconsider later.
|
95
|
+
|
96
|
+
Style/CollectionMethods:
|
97
|
+
Enabled: true
|
98
|
+
PreferredMethods:
|
99
|
+
collect: map
|
100
|
+
collect!: map!
|
101
|
+
find_all: select
|
102
|
+
detect: detect
|
103
|
+
inject: inject
|
104
|
+
|
105
|
+
Style/EmptyElse:
|
106
|
+
# It"s helpful to show intent by including a comment in an else block.
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
Style/EmptyMethod:
|
110
|
+
EnforcedStyle: expanded
|
111
|
+
|
112
|
+
Style/ExpandPathArguments:
|
113
|
+
Exclude:
|
114
|
+
- "object_inspector.gemspec"
|
115
|
+
|
116
|
+
Style/FormatString:
|
117
|
+
Enabled: false # % notation with an Array just reads better sometimes.
|
118
|
+
|
119
|
+
Style/Lambda:
|
120
|
+
EnforcedStyle: literal
|
121
|
+
|
122
|
+
Style/NumericPredicate:
|
123
|
+
AutoCorrect: true
|
124
|
+
|
125
|
+
Style/RegexpLiteral:
|
126
|
+
EnforcedStyle: mixed
|
127
|
+
|
128
|
+
Style/RescueStandardError:
|
129
|
+
EnforcedStyle: implicit
|
130
|
+
|
131
|
+
Style/ReturnNil:
|
132
|
+
Enabled: true
|
133
|
+
|
134
|
+
Style/StringMethods:
|
135
|
+
Enabled: true
|
136
|
+
|
137
|
+
Style/SingleLineMethods:
|
138
|
+
Exclude:
|
139
|
+
- "test/**/*_test.rb"
|
140
|
+
|
141
|
+
Style/StringLiterals:
|
142
|
+
EnforcedStyle: double_quotes
|
143
|
+
|
144
|
+
Style/StringLiteralsInInterpolation:
|
145
|
+
EnforcedStyle: double_quotes
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
### 0.5.0 - 2018-06-11
|
2
|
+
- Add `inspect_issues` to ObjectInspector::TemplatingFormatter.
|
3
|
+
- Add ObjectInspector::Scope#join_name.
|
4
|
+
- Add configurable ObjectInspector.configuration.presented_object_separator.
|
5
|
+
|
6
|
+
|
1
7
|
### 0.4.0 - 2018-05-25
|
2
8
|
- Feature: Add ObjectInspector::Configuration#default_scope setting -- can be used to override the default Scope for object inspection.
|
3
9
|
- Implement ObjectInspector::Scope#== for comparing scopes with scopes and/or scopes with (Arrays of) Strings, Symbols, etc.
|
data/Gemfile.lock
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
object_inspector (0.
|
4
|
+
object_inspector (0.5.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
ansi (1.5.0)
|
10
|
+
ast (2.4.0)
|
11
|
+
axiom-types (0.1.1)
|
12
|
+
descendants_tracker (~> 0.0.4)
|
13
|
+
ice_nine (~> 0.11.0)
|
14
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
10
15
|
benchmark-ips (2.7.2)
|
11
16
|
builder (3.2.3)
|
12
17
|
byebug (10.0.2)
|
18
|
+
codeclimate-engine-rb (0.4.1)
|
19
|
+
virtus (~> 1.0)
|
13
20
|
coderay (1.1.2)
|
14
|
-
|
21
|
+
coercible (1.0.0)
|
22
|
+
descendants_tracker (~> 0.0.1)
|
23
|
+
descendants_tracker (0.0.4)
|
24
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
25
|
+
docile (1.3.1)
|
26
|
+
equalizer (0.0.11)
|
27
|
+
ice_nine (0.11.2)
|
28
|
+
jaro_winkler (1.5.1)
|
15
29
|
json (2.1.0)
|
16
30
|
method_source (0.9.0)
|
17
31
|
minitest (5.11.3)
|
@@ -20,20 +34,44 @@ GEM
|
|
20
34
|
builder
|
21
35
|
minitest (>= 5.0)
|
22
36
|
ruby-progressbar
|
23
|
-
object_identifier (0.1.
|
37
|
+
object_identifier (0.1.1)
|
38
|
+
parallel (1.12.1)
|
39
|
+
parser (2.5.1.0)
|
40
|
+
ast (~> 2.4.0)
|
41
|
+
powerpack (0.1.2)
|
24
42
|
pry (0.11.3)
|
25
43
|
coderay (~> 1.1.0)
|
26
44
|
method_source (~> 0.9.0)
|
27
45
|
pry-byebug (3.6.0)
|
28
46
|
byebug (~> 10.0)
|
29
47
|
pry (~> 0.10)
|
30
|
-
|
48
|
+
rainbow (3.0.0)
|
49
|
+
rake (12.3.1)
|
50
|
+
reek (4.8.1)
|
51
|
+
codeclimate-engine-rb (~> 0.4.0)
|
52
|
+
parser (>= 2.5.0.0, < 2.6)
|
53
|
+
rainbow (>= 2.0, < 4.0)
|
54
|
+
rubocop (0.57.1)
|
55
|
+
jaro_winkler (~> 1.5.1)
|
56
|
+
parallel (~> 1.10)
|
57
|
+
parser (>= 2.5)
|
58
|
+
powerpack (~> 0.1)
|
59
|
+
rainbow (>= 2.2.2, < 4.0)
|
60
|
+
ruby-progressbar (~> 1.7)
|
61
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
31
62
|
ruby-progressbar (1.9.0)
|
32
63
|
simplecov (0.16.1)
|
33
64
|
docile (~> 1.1)
|
34
65
|
json (>= 1.8, < 3)
|
35
66
|
simplecov-html (~> 0.10.0)
|
36
67
|
simplecov-html (0.10.2)
|
68
|
+
thread_safe (0.3.6)
|
69
|
+
unicode-display_width (1.4.0)
|
70
|
+
virtus (1.0.5)
|
71
|
+
axiom-types (~> 0.1)
|
72
|
+
coercible (~> 1.0)
|
73
|
+
descendants_tracker (~> 0.0, >= 0.0.3)
|
74
|
+
equalizer (~> 0.0, >= 0.0.9)
|
37
75
|
|
38
76
|
PLATFORMS
|
39
77
|
ruby
|
@@ -48,8 +86,10 @@ DEPENDENCIES
|
|
48
86
|
object_inspector!
|
49
87
|
pry (~> 0.11)
|
50
88
|
pry-byebug (~> 3.6)
|
51
|
-
rake (~>
|
89
|
+
rake (~> 12.3)
|
90
|
+
reek (~> 4.8)
|
91
|
+
rubocop (~> 0.57)
|
52
92
|
simplecov (~> 0.16)
|
53
93
|
|
54
94
|
BUNDLED WITH
|
55
|
-
1.16.
|
95
|
+
1.16.2
|
data/README.md
CHANGED
@@ -55,6 +55,8 @@ ObjectInspector.configure do |config|
|
|
55
55
|
config.default_scope = ObjectInspector::Scope.new(:self)
|
56
56
|
config.wild_card_scope = "all"
|
57
57
|
config.out_of_scope_placeholder = "*"
|
58
|
+
config.presenter_inspect_flags = " ⇨ "
|
59
|
+
config.name_separator = " - "
|
58
60
|
config.flags_separator = " / "
|
59
61
|
config.info_separator = " | "
|
60
62
|
end
|
@@ -104,15 +106,17 @@ class MyObject
|
|
104
106
|
ObjectInspector::Inspector.inspect(self)
|
105
107
|
end
|
106
108
|
|
107
|
-
private
|
109
|
+
private
|
108
110
|
|
109
111
|
def inspect_identification; "My Object" end
|
110
112
|
def inspect_flags; "FLAG1 / FLAG2" end
|
113
|
+
def inspect_issues; "ISSUE1 | ISSUE2" end
|
111
114
|
def inspect_info; "INFO" end
|
112
115
|
def inspect_name; "NAME" end # Or: def display_name; "NAME" end
|
113
116
|
end
|
114
117
|
|
115
|
-
MyObject.new.inspect
|
118
|
+
MyObject.new.inspect
|
119
|
+
# => "<My Object(FLAG1 / FLAG2) !!ISSUE1 | ISSUE2!! INFO :: NAME>"
|
116
120
|
```
|
117
121
|
|
118
122
|
|
@@ -137,12 +141,14 @@ class MyObject
|
|
137
141
|
def inspect
|
138
142
|
super(identification: "My Object",
|
139
143
|
flags: "FLAG1",
|
144
|
+
issues: "ISSUE1 | ISSUE2",
|
140
145
|
info: "INFO",
|
141
146
|
name: "NAME")
|
142
147
|
end
|
143
148
|
end
|
144
149
|
|
145
|
-
MyObject.new.inspect
|
150
|
+
MyObject.new.inspect
|
151
|
+
# => "<My Object(FLAG1) !!ISSUE1 | ISSUE2!! INFO :: NAME>"
|
146
152
|
```
|
147
153
|
|
148
154
|
Or, define `inspect_identification`, `inspect_flags`, `inspect_info`, and/or `inspect_name` (or `display_name`) in Object.
|
@@ -151,15 +157,17 @@ Or, define `inspect_identification`, `inspect_flags`, `inspect_info`, and/or `in
|
|
151
157
|
class MyObject
|
152
158
|
include ObjectInspector::InspectorsHelper
|
153
159
|
|
154
|
-
private
|
160
|
+
private
|
155
161
|
|
156
162
|
def inspect_identification; "My Object" end
|
157
163
|
def inspect_flags; "FLAG1 / FLAG2" end
|
164
|
+
def inspect_issues; "ISSUE1 | ISSUE2" end
|
158
165
|
def inspect_info; "INFO" end
|
159
166
|
def inspect_name; "NAME" end # Or: def display_name; "NAME" end
|
160
167
|
end
|
161
168
|
|
162
|
-
MyObject.new.inspect
|
169
|
+
MyObject.new.inspect
|
170
|
+
# => "<My Object(FLAG1) !!ISSUE1 | ISSUE2!! INFO :: NAME>"
|
163
171
|
```
|
164
172
|
|
165
173
|
|
@@ -231,11 +239,13 @@ scope.complex? { "MATCH" } # => "*"
|
|
231
239
|
### Scope Joiners
|
232
240
|
|
233
241
|
ObjectInspector::Scope also offers helper methods for uniformly joining inspect elements:
|
242
|
+
- `join_name` -- Joins name parts with ` - ` by default
|
234
243
|
- `join_flags` -- Joins flags with ` / ` by default
|
235
244
|
- `join_info` -- Joins info items with ` | ` by default
|
236
245
|
|
237
246
|
```ruby
|
238
247
|
scope = ObjectInspector::Scope.new(:verbose)
|
248
|
+
scope.join_name([1, 2, 3]) # => "1 - 2 - 3"
|
239
249
|
scope.join_flags([1, 2, 3]) # => "1 / 2 / 3"
|
240
250
|
scope.join_info([1, 2, 3]) # => "1 | 2 | 3"
|
241
251
|
```
|
@@ -263,7 +273,12 @@ class MyObject
|
|
263
273
|
OpenStruct.new(flags: "AO2_FLAG1")
|
264
274
|
end
|
265
275
|
|
266
|
-
|
276
|
+
# Or `def inspect_name`
|
277
|
+
def display_name(scope:)
|
278
|
+
name
|
279
|
+
end
|
280
|
+
|
281
|
+
private
|
267
282
|
|
268
283
|
def inspect_identification
|
269
284
|
identify(:a2)
|
@@ -283,6 +298,10 @@ private
|
|
283
298
|
scope.join_flags(flags)
|
284
299
|
end
|
285
300
|
|
301
|
+
def inspect_issues
|
302
|
+
"!!WARNING!!"
|
303
|
+
end
|
304
|
+
|
286
305
|
def inspect_info(scope:)
|
287
306
|
info = ["Default Info"]
|
288
307
|
info << "Complex Info" if scope.complex?
|
@@ -290,40 +309,36 @@ private
|
|
290
309
|
|
291
310
|
scope.join_info(info)
|
292
311
|
end
|
293
|
-
|
294
|
-
# Or `def inspect_name`
|
295
|
-
def display_name
|
296
|
-
name
|
297
|
-
end
|
298
312
|
end
|
299
313
|
|
300
314
|
my_object = MyObject.new("Name")
|
301
315
|
|
302
316
|
my_object.inspect(scope: :complex)
|
303
|
-
# => "<MyObject[a2:2](DEFAULT_FLAG / *) Default Info | Complex Info | * :: Name>"
|
317
|
+
# => "<MyObject[a2:2](DEFAULT_FLAG / *) !!!!WARNING!!!! Default Info | Complex Info | * :: Name>"
|
304
318
|
|
305
319
|
my_object.inspect(scope: :verbose)
|
306
|
-
# => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) Default Info | Verbose Info :: Name>"
|
320
|
+
# => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!!!WARNING!!!! Default Info | Verbose Info :: Name>"
|
307
321
|
|
308
322
|
my_object.inspect(scope: %i[self complex verbose])
|
309
|
-
# => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) Default Info | Complex Info | Verbose Info :: Name>"
|
323
|
+
# => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!!!WARNING!!!! Default Info | Complex Info | Verbose Info :: Name>"
|
310
324
|
|
311
325
|
my_object.inspect(scope: :all)
|
312
|
-
# => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) Default Info | Complex Info | Verbose Info :: Name>"
|
326
|
+
# => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!!!WARNING!!!! Default Info | Complex Info | Verbose Info :: Name>"
|
313
327
|
|
314
328
|
my_object.inspect
|
315
|
-
# => "<MyObject[a2:2](DEFAULT_FLAG / *) Default Info | * :: Name>"
|
329
|
+
# => "<MyObject[a2:2](DEFAULT_FLAG / *) !!!!WARNING!!!! Default Info | * :: Name>"
|
316
330
|
|
317
331
|
ObjectInspector.configuration.default_scope = :complex
|
318
332
|
my_object.inspect
|
319
|
-
# => "<MyObject[a2:2](DEFAULT_FLAG / *) Default Info | Complex Info | * :: Name>"
|
333
|
+
# => "<MyObject[a2:2](DEFAULT_FLAG / *) !!!!WARNING!!!! Default Info | Complex Info | * :: Name>"
|
320
334
|
|
321
335
|
ObjectInspector.configuration.default_scope = %i[self complex verbose]
|
322
336
|
my_object.inspect
|
337
|
+
# => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!!!WARNING!!!! Default Info | Complex Info | Verbose Info :: Name>"
|
323
338
|
|
324
339
|
ObjectInspector.configuration.default_scope = :all
|
325
340
|
my_object.inspect
|
326
|
-
# => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) Default Info | Complex Info | Verbose Info :: Name>"
|
341
|
+
# => "<MyObject[a2:2](DEFAULT_FLAG / AO1_FLAG1 / AO2_FLAG1) !!!!WARNING!!!! Default Info | Complex Info | Verbose Info :: Name>"
|
327
342
|
```
|
328
343
|
|
329
344
|
|
@@ -339,7 +354,7 @@ class MyWrapperObject
|
|
339
354
|
@to_model ||= MyWrappedObject.new
|
340
355
|
end
|
341
356
|
|
342
|
-
private
|
357
|
+
private
|
343
358
|
|
344
359
|
def inspect_flags; "WRAPPER_FLAG1" end
|
345
360
|
end
|
@@ -347,7 +362,7 @@ end
|
|
347
362
|
class MyWrappedObject
|
348
363
|
include ObjectInspector::InspectorsHelper
|
349
364
|
|
350
|
-
private
|
365
|
+
private
|
351
366
|
|
352
367
|
def inspect_flags; "FLAG1 / FLAG2" end
|
353
368
|
def inspect_info; "INFO" end
|
@@ -428,19 +443,20 @@ class MyObject
|
|
428
443
|
2
|
429
444
|
end
|
430
445
|
|
431
|
-
private
|
446
|
+
private
|
432
447
|
|
433
448
|
def inspect_identification
|
434
449
|
identify(:my_method1, :my_method2)
|
435
450
|
end
|
436
451
|
|
437
452
|
def inspect_flags; "FLAG1 / FLAG2" end
|
453
|
+
def inspect_issues; "ISSUE1 | ISSUE2" end
|
438
454
|
def inspect_info; "INFO" end
|
439
455
|
def inspect_name; "NAME" end
|
440
456
|
end
|
441
457
|
|
442
458
|
MyObject.new.inspect
|
443
|
-
# => "<MyObject[my_method1:1, my_method2:2](FLAG1 / FLAG2) INFO :: NAME>"
|
459
|
+
# => "<MyObject[my_method1:1, my_method2:2](FLAG1 / FLAG2) !!ISSUE1 | ISSUE2!! INFO :: NAME>"
|
444
460
|
```
|
445
461
|
|
446
462
|
|
data/Rakefile
CHANGED
@@ -2,15 +2,14 @@ module ObjectInspector
|
|
2
2
|
# ObjectInspector::Conversions defines conversion functions used by
|
3
3
|
# ObjectInspector.
|
4
4
|
module Conversions
|
5
|
-
|
6
|
-
module_function
|
5
|
+
module_function
|
7
6
|
|
8
7
|
# Convert the passed in value to an {ObjectInspector::Scope} object.
|
9
8
|
# Just returns the pass in value if it already is an
|
10
9
|
# {ObjectInspector::Scope} object.
|
11
10
|
#
|
12
11
|
# @return [ObjectInspector::Scope]
|
13
|
-
def Scope(value)
|
12
|
+
def Scope(value) # rubocop:disable Naming/MethodName
|
14
13
|
case value
|
15
14
|
when ObjectInspector::Scope
|
16
15
|
value
|
@@ -6,8 +6,6 @@ module ObjectInspector
|
|
6
6
|
#
|
7
7
|
# @attr inspector [ObjectInspector::Inspector]
|
8
8
|
class BaseFormatter
|
9
|
-
RIGHT_ARROW_ICON = [0x21E8].pack("U").freeze
|
10
|
-
|
11
9
|
attr_reader :inspector
|
12
10
|
|
13
11
|
def initialize(inspector)
|
@@ -45,6 +43,14 @@ module ObjectInspector
|
|
45
43
|
@flags ||= inspector.flags
|
46
44
|
end
|
47
45
|
|
46
|
+
# Delegates to {Inspector#issues}.
|
47
|
+
#
|
48
|
+
# @return [String] if given
|
49
|
+
# @return [NilClass] if not given
|
50
|
+
def issues
|
51
|
+
@issues ||= inspector.issues
|
52
|
+
end
|
53
|
+
|
48
54
|
# Delegates to {Inspector#info}.
|
49
55
|
#
|
50
56
|
# @return [String] if given
|
@@ -16,10 +16,12 @@ module ObjectInspector
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
private
|
20
20
|
|
21
21
|
def build_wrapped_object_string
|
22
|
-
"#{build_string}
|
22
|
+
"#{build_string} "\
|
23
|
+
"#{ObjectInspector.configuration.presented_object_separator} "\
|
24
|
+
"#{wrapped_object_inspection_result}"
|
23
25
|
end
|
24
26
|
|
25
27
|
def build_string
|
@@ -36,7 +38,7 @@ module ObjectInspector
|
|
36
38
|
build_identification_string,
|
37
39
|
build_flags_string,
|
38
40
|
build_info_string,
|
39
|
-
build_name_string
|
41
|
+
build_name_string
|
40
42
|
].compact
|
41
43
|
end
|
42
44
|
|
@@ -13,6 +13,10 @@ module ObjectInspector
|
|
13
13
|
@name_template ||= "<%s :: %s>".freeze
|
14
14
|
end
|
15
15
|
|
16
|
+
def self.issues_and_name_template
|
17
|
+
@issues_and_name_template ||= "<%s !!%s!! :: %s>".freeze
|
18
|
+
end
|
19
|
+
|
16
20
|
def self.flags_and_name_template
|
17
21
|
@flags_and_name_template ||= "<%s(%s) :: %s>".freeze
|
18
22
|
end
|
@@ -21,18 +25,43 @@ module ObjectInspector
|
|
21
25
|
@info_and_name_template ||= "<%s %s :: %s>".freeze
|
22
26
|
end
|
23
27
|
|
28
|
+
def self.issues_and_info_and_name_template
|
29
|
+
@issues_and_info_and_name_template ||= "<%s !!%s!! %s :: %s>".freeze
|
30
|
+
end
|
31
|
+
|
24
32
|
def self.flags_and_info_template
|
25
33
|
@flags_and_info_template ||= "<%s(%s) %s>".freeze
|
26
34
|
end
|
27
35
|
|
36
|
+
def self.issues_and_info_template
|
37
|
+
@issues_and_info_template ||= "<%s !!%s!! %s>".freeze
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.flags_and_issues_and_info_template
|
41
|
+
@flags_and_issues_and_info_template ||= "<%s(%s) !!%s!! %s>".freeze
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.flags_and_issues_and_name_template
|
45
|
+
@flags_and_issues_and_name_template ||= "<%s(%s) !!%s!! :: %s>".freeze
|
46
|
+
end
|
47
|
+
|
28
48
|
def self.flags_and_info_and_name_template
|
29
49
|
@flags_and_info_and_name_template ||= "<%s(%s) %s :: %s>".freeze
|
30
50
|
end
|
31
51
|
|
52
|
+
def self.flags_and_issues_and_info_and_name_template
|
53
|
+
@flags_and_issues_and_info_and_name_template ||=
|
54
|
+
"<%s(%s) !!%s!! %s :: %s>".freeze
|
55
|
+
end
|
56
|
+
|
32
57
|
def self.flags_template
|
33
58
|
@flags_template ||= "<%s(%s)>".freeze
|
34
59
|
end
|
35
60
|
|
61
|
+
def self.issues_template
|
62
|
+
@issues_template ||= "<%s !!%s!!>".freeze
|
63
|
+
end
|
64
|
+
|
36
65
|
def self.info_template
|
37
66
|
@info_template ||= "<%s %s>".freeze
|
38
67
|
end
|
@@ -48,96 +77,167 @@ module ObjectInspector
|
|
48
77
|
end
|
49
78
|
end
|
50
79
|
|
51
|
-
|
80
|
+
private
|
52
81
|
|
53
82
|
def build_wrapped_object_string
|
54
|
-
"#{build_string}
|
83
|
+
"#{build_string} "\
|
84
|
+
"#{ObjectInspector.configuration.presented_object_separator} "\
|
85
|
+
"#{wrapped_object_inspection_result}"
|
55
86
|
end
|
56
87
|
|
88
|
+
# rubocop:disable Metrics/MethodLength
|
57
89
|
def build_string
|
58
90
|
if flags
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
else
|
63
|
-
build_flags_and_info_string
|
64
|
-
end
|
65
|
-
elsif name
|
66
|
-
build_flags_and_name_string
|
67
|
-
else
|
68
|
-
build_flags_string
|
69
|
-
end
|
91
|
+
build_string_with_flags_and_maybe_issues_and_info_and_name
|
92
|
+
elsif issues
|
93
|
+
build_string_with_issues_and_maybe_info_and_name
|
70
94
|
elsif info
|
71
|
-
|
72
|
-
build_info_and_name_string
|
73
|
-
else
|
74
|
-
build_info_string
|
75
|
-
end
|
95
|
+
build_string_with_info_and_maybe_name
|
76
96
|
elsif name
|
77
|
-
|
97
|
+
build_string_with_name
|
78
98
|
else
|
79
99
|
build_base_string
|
80
100
|
end
|
81
101
|
end
|
102
|
+
# rubocop:enable Metrics/MethodLength
|
103
|
+
|
104
|
+
def build_string_with_flags_and_maybe_issues_and_info_and_name
|
105
|
+
if issues
|
106
|
+
build_string_with_flags_and_issues_and_maybe_info_and_name
|
107
|
+
elsif info
|
108
|
+
build_string_with_flags_and_info_and_maybe_name
|
109
|
+
elsif name
|
110
|
+
build_string_with_flags_and_name
|
111
|
+
else
|
112
|
+
build_string_with_flags
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def build_string_with_flags_and_issues_and_maybe_info_and_name
|
117
|
+
if info
|
118
|
+
build_string_with_flags_and_issues_and_info_and_maybe_name
|
119
|
+
elsif name
|
120
|
+
build_string_with_flags_and_issues_and_name
|
121
|
+
else
|
122
|
+
build_string_with_flags_and_issues
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def build_string_with_flags_and_issues_and_info_and_maybe_name
|
127
|
+
if name
|
128
|
+
build_string_with_flags_and_issues_and_info_and_name
|
129
|
+
else
|
130
|
+
build_string_with_flags_and_issues_and_info
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def build_string_with_issues_and_maybe_info_and_name
|
135
|
+
if info
|
136
|
+
build_string_with_issues_and_info_and_maybe_name
|
137
|
+
elsif name
|
138
|
+
build_string_with_issues_and_name
|
139
|
+
else
|
140
|
+
build_string_with_issues
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def build_string_with_issues_and_info_and_maybe_name
|
145
|
+
if name
|
146
|
+
build_string_with_issues_and_info_and_name
|
147
|
+
else
|
148
|
+
build_string_with_issues_and_info
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def build_string_with_flags_and_maybe_info_and_name
|
153
|
+
if info
|
154
|
+
build_string_with_flags_and_info_and_maybe_name
|
155
|
+
elsif name
|
156
|
+
build_string_with_flags_and_name
|
157
|
+
else
|
158
|
+
build_string_with_flags
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def build_string_with_flags_and_info_and_maybe_name
|
163
|
+
if name
|
164
|
+
build_string_with_flags_and_info_and_name
|
165
|
+
else
|
166
|
+
build_string_with_flags_and_info
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def build_string_with_info_and_maybe_name
|
171
|
+
if name
|
172
|
+
build_string_with_info_and_name
|
173
|
+
else
|
174
|
+
build_string_with_info
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
def build_string_with_flags_and_issues_and_info_and_name
|
179
|
+
self.class.flags_and_issues_and_info_and_name_template %
|
180
|
+
[identification, flags, issues, info, name]
|
181
|
+
end
|
182
|
+
|
183
|
+
def build_string_with_flags_and_issues_and_name
|
184
|
+
self.class.flags_and_issues_and_name_template %
|
185
|
+
[identification, flags, issues, name]
|
186
|
+
end
|
187
|
+
|
188
|
+
def build_string_with_flags_and_info_and_name
|
189
|
+
self.class.flags_and_info_and_name_template %
|
190
|
+
[identification, flags, info, name]
|
191
|
+
end
|
192
|
+
|
193
|
+
def build_string_with_issues_and_info_and_name
|
194
|
+
self.class.issues_and_info_and_name_template %
|
195
|
+
[identification, issues, info, name]
|
196
|
+
end
|
197
|
+
|
198
|
+
def build_string_with_flags_and_issues_and_info
|
199
|
+
self.class.flags_and_issues_and_info_template %
|
200
|
+
[identification, flags, issues, info]
|
201
|
+
end
|
202
|
+
|
203
|
+
def build_string_with_flags_and_info
|
204
|
+
self.class.flags_and_info_template % [identification, flags, info]
|
205
|
+
end
|
206
|
+
|
207
|
+
def build_string_with_flags_and_name
|
208
|
+
self.class.flags_and_name_template % [identification, flags, name]
|
209
|
+
end
|
82
210
|
|
83
|
-
def
|
84
|
-
self.class.
|
85
|
-
identification,
|
86
|
-
flags,
|
87
|
-
info,
|
88
|
-
name
|
89
|
-
]
|
211
|
+
def build_string_with_issues_and_info
|
212
|
+
self.class.issues_and_info_template % [identification, issues, info]
|
90
213
|
end
|
91
214
|
|
92
|
-
def
|
93
|
-
self.class.
|
94
|
-
identification,
|
95
|
-
flags,
|
96
|
-
info
|
97
|
-
]
|
215
|
+
def build_string_with_issues_and_name
|
216
|
+
self.class.issues_and_name_template % [identification, issues, name]
|
98
217
|
end
|
99
218
|
|
100
|
-
def
|
101
|
-
self.class.
|
102
|
-
identification,
|
103
|
-
flags,
|
104
|
-
name
|
105
|
-
]
|
219
|
+
def build_string_with_info_and_name
|
220
|
+
self.class.info_and_name_template % [identification, info, name]
|
106
221
|
end
|
107
222
|
|
108
|
-
def
|
109
|
-
self.class.
|
110
|
-
identification,
|
111
|
-
info,
|
112
|
-
name
|
113
|
-
]
|
223
|
+
def build_string_with_flags
|
224
|
+
self.class.flags_template % [identification, flags]
|
114
225
|
end
|
115
226
|
|
116
|
-
def
|
117
|
-
self.class.
|
118
|
-
identification,
|
119
|
-
name
|
120
|
-
]
|
227
|
+
def build_string_with_issues
|
228
|
+
self.class.issues_template % [identification, issues]
|
121
229
|
end
|
122
230
|
|
123
|
-
def
|
124
|
-
self.class.
|
125
|
-
identification,
|
126
|
-
flags
|
127
|
-
]
|
231
|
+
def build_string_with_info
|
232
|
+
self.class.info_template % [identification, info]
|
128
233
|
end
|
129
234
|
|
130
|
-
def
|
131
|
-
self.class.
|
132
|
-
identification,
|
133
|
-
info
|
134
|
-
]
|
235
|
+
def build_string_with_name
|
236
|
+
self.class.name_template % [identification, name]
|
135
237
|
end
|
136
238
|
|
137
239
|
def build_base_string
|
138
|
-
self.class.base_template % [
|
139
|
-
identification
|
140
|
-
]
|
240
|
+
self.class.base_template % [identification]
|
141
241
|
end
|
142
242
|
end
|
143
243
|
end
|
@@ -49,12 +49,12 @@ module ObjectInspector
|
|
49
49
|
# @return [String] if {#object_is_a_wrapper}
|
50
50
|
# @return [NilClass] if not {#object_is_a_wrapper}
|
51
51
|
def wrapped_object_inspection_result
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
52
|
+
return unless object_is_a_wrapper?
|
53
|
+
|
54
|
+
self.class.inspect(
|
55
|
+
extract_wrapped_object,
|
56
|
+
scope: scope,
|
57
|
+
formatter: formatter_klass)
|
58
58
|
end
|
59
59
|
|
60
60
|
# Core object identification details, such as the {#object} class name and
|
@@ -73,6 +73,14 @@ module ObjectInspector
|
|
73
73
|
value(key: :flags)
|
74
74
|
end
|
75
75
|
|
76
|
+
# Issues/Warnings applicable to {#object}.
|
77
|
+
#
|
78
|
+
# @return [String] if given
|
79
|
+
# @return [NilClass] if not given
|
80
|
+
def issues
|
81
|
+
value(key: :issues)
|
82
|
+
end
|
83
|
+
|
76
84
|
# Informational details applicable to {#object}.
|
77
85
|
#
|
78
86
|
# @return [String] if given
|
@@ -91,7 +99,7 @@ module ObjectInspector
|
|
91
99
|
kargs: object_method_keyword_arguments)
|
92
100
|
end
|
93
101
|
|
94
|
-
|
102
|
+
private
|
95
103
|
|
96
104
|
def formatter
|
97
105
|
formatter_klass.new(self)
|
@@ -157,7 +165,7 @@ module ObjectInspector
|
|
157
165
|
|
158
166
|
def object_method_keyword_arguments
|
159
167
|
{
|
160
|
-
scope: scope
|
168
|
+
scope: scope
|
161
169
|
}
|
162
170
|
end
|
163
171
|
|
@@ -19,6 +19,15 @@ module ObjectInspector
|
|
19
19
|
@names = Array(names).map { |name| String(name) }
|
20
20
|
end
|
21
21
|
|
22
|
+
# Join the passed-in name parts with the passed in separator.
|
23
|
+
#
|
24
|
+
# @param items [Array<#to_s>]
|
25
|
+
# @param separator [#to_s] (ObjectInspector.configuration.flags_separator)
|
26
|
+
def join_name(parts,
|
27
|
+
separator: ObjectInspector.configuration.name_separator)
|
28
|
+
Array(parts).join(separator)
|
29
|
+
end
|
30
|
+
|
22
31
|
# Join the passed-in flags with the passed in separator.
|
23
32
|
#
|
24
33
|
# @param items [Array<#to_s>]
|
@@ -28,12 +37,21 @@ module ObjectInspector
|
|
28
37
|
Array(flags).join(separator)
|
29
38
|
end
|
30
39
|
|
40
|
+
# Join the passed-in issues with the passed in separator.
|
41
|
+
#
|
42
|
+
# @param items [Array<#to_s>]
|
43
|
+
# @param separator [#to_s] (ObjectInspector.configuration.issues_separator)
|
44
|
+
def join_issues(issues,
|
45
|
+
separator: ObjectInspector.configuration.issues_separator)
|
46
|
+
Array(issues).join(separator)
|
47
|
+
end
|
48
|
+
|
31
49
|
# Join the passed-in items with the passed in separator.
|
32
50
|
#
|
33
51
|
# @param items [Array<#to_s>]
|
34
52
|
# @param separator [#to_s] (ObjectInspector.configuration.info_separator)
|
35
53
|
def join_info(items,
|
36
|
-
|
54
|
+
separator: ObjectInspector.configuration.info_separator)
|
37
55
|
Array(items).join(separator)
|
38
56
|
end
|
39
57
|
|
@@ -56,7 +74,7 @@ module ObjectInspector
|
|
56
74
|
names
|
57
75
|
end
|
58
76
|
|
59
|
-
|
77
|
+
private
|
60
78
|
|
61
79
|
def method_missing(method_name, *args, &block)
|
62
80
|
if method_name[-1] == "?"
|
@@ -77,9 +95,9 @@ module ObjectInspector
|
|
77
95
|
end
|
78
96
|
end
|
79
97
|
|
80
|
-
def evaluate_block_if(condition
|
98
|
+
def evaluate_block_if(condition)
|
81
99
|
if condition
|
82
|
-
|
100
|
+
yield(self)
|
83
101
|
else
|
84
102
|
ObjectInspector.configuration.out_of_scope_placeholder
|
85
103
|
end
|
@@ -91,7 +109,7 @@ module ObjectInspector
|
|
91
109
|
end
|
92
110
|
|
93
111
|
def wild_card_scope?
|
94
|
-
@
|
112
|
+
@wild_card_scope ||=
|
95
113
|
any_names_match?(ObjectInspector.configuration.wild_card_scope)
|
96
114
|
end
|
97
115
|
|
data/lib/object_inspector.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
# ObjectInspector is the base namespace for all modules/classes related to the
|
2
2
|
# object_inspector gem.
|
3
3
|
module ObjectInspector
|
4
|
-
class << self
|
5
|
-
attr_writer :configuration
|
6
|
-
end
|
7
|
-
|
8
4
|
def self.configuration
|
9
5
|
@configuration ||= Configuration.new
|
10
6
|
end
|
@@ -17,13 +13,19 @@ module ObjectInspector
|
|
17
13
|
@configuration = Configuration.new
|
18
14
|
end
|
19
15
|
|
16
|
+
# ObjectInspector::Configuration stores the default configuration options for
|
17
|
+
# the ObjectInspector gem. Modification of attributes is possible at any time,
|
18
|
+
# and values will persist for the duration of the running process.
|
20
19
|
class Configuration
|
21
20
|
attr_reader :formatter_class,
|
22
21
|
:inspect_method_prefix,
|
23
22
|
:default_scope,
|
24
23
|
:wild_card_scope,
|
25
24
|
:out_of_scope_placeholder,
|
25
|
+
:presented_object_separator,
|
26
|
+
:name_separator,
|
26
27
|
:flags_separator,
|
28
|
+
:issues_separator,
|
27
29
|
:info_separator
|
28
30
|
|
29
31
|
def initialize
|
@@ -32,7 +34,10 @@ module ObjectInspector
|
|
32
34
|
@default_scope = Scope.new(:self)
|
33
35
|
@wild_card_scope = "all".freeze
|
34
36
|
@out_of_scope_placeholder = "*".freeze
|
37
|
+
@presented_object_separator = " #{[0x21E8].pack("U")} ".freeze
|
38
|
+
@name_separator = " - ".freeze
|
35
39
|
@flags_separator = " / ".freeze
|
40
|
+
@issues_separator = " | ".freeze
|
36
41
|
@info_separator = " | ".freeze
|
37
42
|
end
|
38
43
|
|
@@ -60,10 +65,22 @@ module ObjectInspector
|
|
60
65
|
@out_of_scope_placeholder = value.to_s.freeze
|
61
66
|
end
|
62
67
|
|
68
|
+
def presented_object_separator=(value)
|
69
|
+
@presented_object_separator = value.to_s.freeze
|
70
|
+
end
|
71
|
+
|
72
|
+
def name_separator=(value)
|
73
|
+
@name_separator = value.to_s.freeze
|
74
|
+
end
|
75
|
+
|
63
76
|
def flags_separator=(value)
|
64
77
|
@flags_separator = value.to_s.freeze
|
65
78
|
end
|
66
79
|
|
80
|
+
def issues_separator=(value)
|
81
|
+
@issues_separator = value.to_s.freeze
|
82
|
+
end
|
83
|
+
|
67
84
|
def info_separator=(value)
|
68
85
|
@info_separator = value.to_s.freeze
|
69
86
|
end
|
data/object_inspector.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
lib = File.expand_path("../lib", __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require "object_inspector/version"
|
@@ -9,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
9
8
|
spec.authors = ["Paul Dobbins"]
|
10
9
|
spec.email = ["paul.dobbins@icloud.com"]
|
11
10
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
11
|
+
spec.summary = "ObjectInspector builds uniformly formatted inspect output with customizable amounts of detail."
|
12
|
+
spec.description = "ObjectInspector takes Object#inspect to the next level. Specify any combination of identification attributes, flags, info, and/or a name along with an optional, self-definable scope option to represents objects. Great for the console, logging, etc."
|
14
13
|
spec.homepage = "https://github.com/pdobb/object_inspector"
|
15
14
|
spec.license = "MIT"
|
16
15
|
|
@@ -23,21 +22,24 @@ Gem::Specification.new do |spec|
|
|
23
22
|
# "public gem pushes."
|
24
23
|
# end
|
25
24
|
|
26
|
-
spec.files
|
27
|
-
|
28
|
-
|
25
|
+
spec.files =
|
26
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
29
|
spec.bindir = "exe"
|
30
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
|
+
spec.add_development_dependency "benchmark-ips", "~> 2.7"
|
33
34
|
spec.add_development_dependency "bundler", "~> 1.16"
|
34
|
-
spec.add_development_dependency "
|
35
|
+
spec.add_development_dependency "byebug", "~> 10.0"
|
35
36
|
spec.add_development_dependency "minitest", "~> 5.0"
|
36
37
|
spec.add_development_dependency "minitest-reporters", "~> 1.2"
|
37
|
-
spec.add_development_dependency "
|
38
|
-
spec.add_development_dependency "byebug", "~> 10.0"
|
38
|
+
spec.add_development_dependency "object_identifier", "~> 0.1"
|
39
39
|
spec.add_development_dependency "pry", "~> 0.11"
|
40
40
|
spec.add_development_dependency "pry-byebug", "~> 3.6"
|
41
|
-
spec.add_development_dependency "
|
42
|
-
spec.add_development_dependency "
|
41
|
+
spec.add_development_dependency "rake", "~> 12.3"
|
42
|
+
spec.add_development_dependency "reek", "~> 4.8"
|
43
|
+
spec.add_development_dependency "rubocop", "~> 0.57"
|
44
|
+
spec.add_development_dependency "simplecov", "~> 0.16"
|
43
45
|
end
|
@@ -9,7 +9,7 @@ custom_formatter_klasses ||= []
|
|
9
9
|
formatter_klasses = [
|
10
10
|
ObjectInspector::TemplatingFormatter,
|
11
11
|
ObjectInspector::CombiningFormatter,
|
12
|
-
*Array(custom_formatter_klasses)
|
12
|
+
*Array(custom_formatter_klasses)
|
13
13
|
]
|
14
14
|
|
15
15
|
INSPECTOR_WITH_FLAGS_AND_INFO_AND_NAME ||=
|
@@ -49,7 +49,6 @@ INSPECTOR_WITH_BASE ||=
|
|
49
49
|
OpenStruct.new(
|
50
50
|
identification: "IDENTIFICATION")
|
51
51
|
|
52
|
-
|
53
52
|
puts "== Averaged ============================================================="
|
54
53
|
Benchmark.ips { |x|
|
55
54
|
formatter_klasses.each do |formatter_klass|
|
@@ -66,10 +65,9 @@ Benchmark.ips { |x|
|
|
66
65
|
end
|
67
66
|
|
68
67
|
x.compare!
|
69
|
-
}
|
68
|
+
}
|
70
69
|
puts "== Done"
|
71
70
|
|
72
|
-
|
73
71
|
puts "== Individualized ======================================================="
|
74
72
|
Benchmark.ips { |x|
|
75
73
|
formatter_klasses.each do |formatter_klass|
|
@@ -114,5 +112,5 @@ Benchmark.ips { |x|
|
|
114
112
|
end
|
115
113
|
|
116
114
|
x.compare!
|
117
|
-
}
|
115
|
+
}
|
118
116
|
puts "== Done"
|
@@ -43,7 +43,6 @@ OBJECT_WITH_BASE ||=
|
|
43
43
|
OpenStruct.new(
|
44
44
|
identification: "IDENTIFICATION")
|
45
45
|
|
46
|
-
|
47
46
|
puts "== Averaged ============================================================="
|
48
47
|
Benchmark.ips { |x|
|
49
48
|
x.report(inspector_klass) {
|
@@ -69,5 +68,5 @@ Benchmark.ips { |x|
|
|
69
68
|
}
|
70
69
|
|
71
70
|
x.compare!
|
72
|
-
}
|
71
|
+
}
|
73
72
|
puts "== Done"
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: object_inspector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Dobbins
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: benchmark-ips
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.7'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -25,7 +39,7 @@ dependencies:
|
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '1.16'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
42
|
+
name: byebug
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
@@ -67,89 +81,103 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '1.2'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: object_identifier
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
89
|
+
version: '0.1'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
96
|
+
version: '0.1'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: pry
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
103
|
+
version: '0.11'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
110
|
+
version: '0.11'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name: pry
|
112
|
+
name: pry-byebug
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
117
|
+
version: '3.6'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
124
|
+
version: '3.6'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: rake
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: '3
|
131
|
+
version: '12.3'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: '3
|
138
|
+
version: '12.3'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
140
|
+
name: reek
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
143
|
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
145
|
+
version: '4.8'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
152
|
+
version: '4.8'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
154
|
+
name: rubocop
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0.
|
159
|
+
version: '0.57'
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0.
|
166
|
+
version: '0.57'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: simplecov
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0.16'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0.16'
|
153
181
|
description: ObjectInspector takes Object#inspect to the next level. Specify any combination
|
154
182
|
of identification attributes, flags, info, and/or a name along with an optional,
|
155
183
|
self-definable scope option to represents objects. Great for the console, logging,
|
@@ -161,6 +189,8 @@ extensions: []
|
|
161
189
|
extra_rdoc_files: []
|
162
190
|
files:
|
163
191
|
- ".gitignore"
|
192
|
+
- ".rubocop"
|
193
|
+
- ".rubocop.yml"
|
164
194
|
- ".travis.yml"
|
165
195
|
- CHANGELOG.md
|
166
196
|
- Gemfile
|
@@ -203,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
233
|
version: '0'
|
204
234
|
requirements: []
|
205
235
|
rubyforge_project:
|
206
|
-
rubygems_version: 2.7.
|
236
|
+
rubygems_version: 2.7.7
|
207
237
|
signing_key:
|
208
238
|
specification_version: 4
|
209
239
|
summary: ObjectInspector builds uniformly formatted inspect output with customizable
|