object_inspector 0.6.0 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5bfaac0270b232c17c91495180cf29e5a4538c1010e636cf681832d6668ba8c
4
- data.tar.gz: fd5e4add5c7a5c7d971ec22a4d5ba80e78642d4df9e060c6382b6b7a93e67551
3
+ metadata.gz: b3f1b53680d632fb88f63e951032b3be151ac352501620742cc091aaaf15a244
4
+ data.tar.gz: 4a059bdf8a0f6033d52bd05c1bb24ad83d33f7dde4d0b8ccd7ae010630566506
5
5
  SHA512:
6
- metadata.gz: 0b31e59f84e625d766309ba1dd760a87bba5b70007214aeec3dd3f47c44e64446db34c640a5a9c35923881178eb61c98080138d542ba1fe1b632a93d1269b4ee
7
- data.tar.gz: 777ee932d2e9fa0c0d4c013dd9f0c8713956afafd883ce866fccb93f23b25fa8eaddb729b6035fd74c514bf9865f40bca09cb06fc2153a4f927458b7dbdbad45
6
+ metadata.gz: 31eb8c71b23c092697db6b8f35b787581a472c13f6aded499602731546b2121fd07952650319e836af6368cf745f29f156ac2a31722a09a6d83cadb4c238e2d4
7
+ data.tar.gz: 6e605745d774bcca73bf93ccd6b818044bb10365832c2f3b2f182bb1884b4de145f0328d81d82ae78fdf65a4609053f51b242ba2790e6071ca083111f5becc7b
data/.rubocop.yml CHANGED
@@ -36,15 +36,18 @@ Layout/EmptyLineAfterGuardClause:
36
36
  Layout/EndOfLine:
37
37
  EnforcedStyle: lf
38
38
 
39
- Layout/FirstParameterIndentation:
39
+ Layout/IndentFirstArgument:
40
40
  EnforcedStyle: consistent_relative_to_receiver
41
41
 
42
- Layout/IndentArray:
42
+ Layout/IndentFirstArrayElement:
43
43
  EnforcedStyle: consistent
44
44
 
45
- Layout/IndentHash:
45
+ Layout/IndentFirstHashElement:
46
46
  EnforcedStyle: consistent
47
47
 
48
+ Layout/IndentFirstParameter:
49
+ Enabled: false # Revisit if more settings become available.
50
+
48
51
  Layout/MultilineAssignmentLayout:
49
52
  Enabled: true
50
53
 
data/CHANGELOG.md CHANGED
@@ -1,9 +1,16 @@
1
- ### 0.6.0 - 2019-03-13
2
- - Fix inspection of delegating wrapper objects
1
+ ### 0.6.2 - 2022-12-30
2
+ - Internal spruce-up for Ruby 3.2. No outward-facing changes.
3
+ - Remove travis-ci config since travis-ci is no longer in use.
4
+
5
+ ### 0.6.1 - 2019-06-27
6
+ - Flatten and compact arrays of `nil`s as well as nested arrays of `nil`s in join_* methods.
3
7
 
8
+ ### 0.6.0 - 2019-03-13
9
+ - Fix inspection of delegating wrapper objects.
10
+ - Allow clearing output of inspect methods.
4
11
 
5
12
  ### 0.5.2 - 2019-02-24
6
- - Automatically compact nils in join_* methods
13
+ - Automatically compact nils in join_* methods.
7
14
 
8
15
  ### 0.5.1 - 2018-06-12
9
16
  - Don't include empty strings from Scope#join_* methods when applicable.
@@ -13,29 +20,23 @@
13
20
  - Add ObjectInspector::Scope#join_name.
14
21
  - Add configurable ObjectInspector.configuration.presented_object_separator.
15
22
 
16
-
17
23
  ### 0.4.0 - 2018-05-25
18
24
  - Feature: Add ObjectInspector::Configuration#default_scope setting -- can be used to override the default Scope for object inspection.
19
25
  - Implement ObjectInspector::Scope#== for comparing scopes with scopes and/or scopes with (Arrays of) Strings, Symbols, etc.
20
26
 
21
-
22
27
  ### 0.3.1 - 2018-04-15
23
28
  - Add ObjectInspector::Configuration#formatter_class setting for overriding the default Formatter.
24
29
 
25
-
26
30
  ### 0.3.0 - 2018-04-14
27
-
28
31
  - Remove optional dependency on ActiveSupport::StringInquirer. [Scopes are now objects](https://github.com/pdobb/object_inspector/blob/master/lib/object_inspector/scope.rb) that act like ActiveSupport::StringInquirer objects.
29
32
  - Add ObjectInspector::Scope.join_flags helper method.
30
33
  - Add ObjectInspector::Scope.join_info helper method.
31
34
  - Scope: Show an out-of-scope-placeholder symbol (*) when predicate is not matched and a block is given.
32
35
  - Scope: Add wild-card "all" scope that is always evaluated as true / a match.
33
- - Add ability to specify multiple scopes. e.g. my_object.inspect(scope: %i[verbose complex])
36
+ - Add ability to specify multiple scopes. e.g. my_object.inspect(scope: %i[verbose complex]).
34
37
  - Add gem defaults configuration.
35
38
 
36
-
37
39
  ### 0.2.0 - 2018-04-12
38
-
39
40
  - Automatically inspect wrapped Objects, if applicable.
40
41
  - Use `display_name` if defined on object, in place of `inspect_name`.
41
42
  - Add on-the-fly inspect methods when Symbols are passed in to #inspect.
@@ -45,5 +46,4 @@
45
46
 
46
47
 
47
48
  ### 0.1.0 - 2018-04-09
48
-
49
49
  - Initial release!
data/Gemfile.lock CHANGED
@@ -1,82 +1,65 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- object_inspector (0.6.0)
4
+ object_inspector (0.6.2)
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)
15
- benchmark-ips (2.7.2)
16
- builder (3.2.3)
17
- byebug (11.0.0)
18
- codeclimate-engine-rb (0.4.1)
19
- virtus (~> 1.0)
20
- coderay (1.1.2)
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.2)
29
- json (2.2.0)
10
+ ast (2.4.2)
11
+ benchmark-ips (2.10.0)
12
+ builder (3.2.4)
13
+ byebug (11.1.3)
14
+ coderay (1.1.3)
15
+ docile (1.4.0)
16
+ json (2.6.3)
30
17
  kwalify (0.7.2)
31
- method_source (0.9.2)
32
- minitest (5.11.3)
33
- minitest-reporters (1.3.6)
18
+ method_source (1.0.0)
19
+ minitest (5.16.3)
20
+ minitest-reporters (1.5.0)
34
21
  ansi
35
22
  builder
36
23
  minitest (>= 5.0)
37
24
  ruby-progressbar
38
- object_identifier (0.2.1)
39
- parallel (1.14.0)
40
- parser (2.6.0.0)
41
- ast (~> 2.4.0)
42
- powerpack (0.1.2)
43
- pry (0.12.2)
44
- coderay (~> 1.1.0)
45
- method_source (~> 0.9.0)
46
- pry-byebug (3.7.0)
25
+ object_identifier (0.4.1)
26
+ parallel (1.22.1)
27
+ parser (3.1.3.0)
28
+ ast (~> 2.4.1)
29
+ pry (0.14.1)
30
+ coderay (~> 1.1)
31
+ method_source (~> 1.0)
32
+ pry-byebug (3.10.1)
47
33
  byebug (~> 11.0)
48
- pry (~> 0.10)
49
- psych (3.1.0)
50
- rainbow (3.0.0)
51
- rake (12.3.2)
52
- reek (5.3.1)
53
- codeclimate-engine-rb (~> 0.4.0)
34
+ pry (>= 0.13, < 0.15)
35
+ rainbow (3.1.1)
36
+ rake (13.0.6)
37
+ reek (6.1.3)
54
38
  kwalify (~> 0.7.0)
55
- parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
56
- psych (~> 3.1.0)
39
+ parser (~> 3.1.0)
57
40
  rainbow (>= 2.0, < 4.0)
58
- rubocop (0.65.0)
59
- jaro_winkler (~> 1.5.1)
41
+ regexp_parser (2.6.1)
42
+ rexml (3.2.5)
43
+ rubocop (1.41.1)
44
+ json (~> 2.3)
60
45
  parallel (~> 1.10)
61
- parser (>= 2.5, != 2.5.1.1)
62
- powerpack (~> 0.1)
63
- psych (>= 3.1.0)
46
+ parser (>= 3.1.2.1)
64
47
  rainbow (>= 2.2.2, < 4.0)
48
+ regexp_parser (>= 1.8, < 3.0)
49
+ rexml (>= 3.2.5, < 4.0)
50
+ rubocop-ast (>= 1.23.0, < 2.0)
65
51
  ruby-progressbar (~> 1.7)
66
- unicode-display_width (~> 1.4.0)
67
- ruby-progressbar (1.10.0)
68
- simplecov (0.16.1)
52
+ unicode-display_width (>= 1.4.0, < 3.0)
53
+ rubocop-ast (1.24.1)
54
+ parser (>= 3.1.1.0)
55
+ ruby-progressbar (1.11.0)
56
+ simplecov (0.22.0)
69
57
  docile (~> 1.1)
70
- json (>= 1.8, < 3)
71
- simplecov-html (~> 0.10.0)
72
- simplecov-html (0.10.2)
73
- thread_safe (0.3.6)
74
- unicode-display_width (1.4.1)
75
- virtus (1.0.5)
76
- axiom-types (~> 0.1)
77
- coercible (~> 1.0)
78
- descendants_tracker (~> 0.0, >= 0.0.3)
79
- equalizer (~> 0.0, >= 0.0.9)
58
+ simplecov-html (~> 0.11)
59
+ simplecov_json_formatter (~> 0.1)
60
+ simplecov-html (0.12.3)
61
+ simplecov_json_formatter (0.1.4)
62
+ unicode-display_width (2.3.0)
80
63
 
81
64
  PLATFORMS
82
65
  ruby
@@ -97,4 +80,4 @@ DEPENDENCIES
97
80
  simplecov
98
81
 
99
82
  BUNDLED WITH
100
- 2.0.1
83
+ 2.4.1
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018 Paul Dobbins
3
+ Copyright (c) 2023 Paul DobbinSchmaltz
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,13 +1,12 @@
1
1
  # ObjectInspector
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/object_inspector.svg)](https://badge.fury.io/rb/object_inspector)
4
- [![Build Status](https://travis-ci.org/pdobb/object_inspector.svg?branch=master)](https://travis-ci.org/pdobb/object_inspector)
5
4
  [![Test Coverage](https://api.codeclimate.com/v1/badges/34e821263d9e0c33d536/test_coverage)](https://codeclimate.com/github/pdobb/object_inspector/test_coverage)
6
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/34e821263d9e0c33d536/maintainability)](https://codeclimate.com/github/pdobb/object_inspector/maintainability)
7
6
 
8
- ObjectInspector 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 represents objects. Great for the console, logging, etc.
7
+ ObjectInspector 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.
9
8
 
10
- Because object inspection code should be uniform, easy to build, and its output should be easy to read!
9
+ Why? Because object inspection code should be uniform, easy to build, and its output should be easy to read!
11
10
 
12
11
  If you'd like to just jump into an example: [Full Example](#full-example).
13
12
 
@@ -36,7 +35,9 @@ Tested MRI Ruby Versions:
36
35
  * 2.4
37
36
  * 2.5
38
37
  * 2.6
39
- * edge
38
+ * 2.7
39
+ * 3.1
40
+ * 3.2
40
41
 
41
42
  ObjectInspector has no other dependencies.
42
43
 
@@ -455,6 +456,28 @@ MyObject.new.inspect(info: :my_method2) # => "<MyObject Result2>"
455
456
  MyObject.new.inspect # => "<MyObject my_method2>"
456
457
  ```
457
458
 
459
+ ## Clearing Output for Specified Inspect Method
460
+
461
+ Pass `nil` to any inspect method type to not display it:
462
+
463
+ ```ruby
464
+ class MyObject
465
+ include ObjectInspector::InspectorsHelper
466
+
467
+ def inspect_identification; "My Object" end
468
+ def inspect_info; "INFO" end
469
+ def inspect_flags; "FLAG1" end
470
+ def inspect_issues; "ISSUE1" end
471
+ end
472
+
473
+ MyObject.new.inspect
474
+ # => "<My Object(FLAG1) !!ISSUE1!! INFO>"
475
+ MyObject.new.inspect(info: nil, flags: nil, issues: nil)
476
+ # => "<My Object>"
477
+ MyObject.new.inspect(identification: nil, info: nil, flags: nil, issues: nil)
478
+ # => "<MyObject>"
479
+ ```
480
+
458
481
 
459
482
  ## Custom Formatters
460
483
 
@@ -580,7 +603,9 @@ play scripts/benchmarking/formatters.rb
580
603
 
581
604
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
582
605
 
583
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
606
+ To install this gem onto your local machine, run `bundle exec rake install`.
607
+
608
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
584
609
 
585
610
 
586
611
  ## Contributing
@@ -27,8 +27,7 @@ module ObjectInspector
27
27
  # @param separator [#to_s] (ObjectInspector.configuration.flags_separator)
28
28
  def join_name(parts,
29
29
  separator: ObjectInspector.configuration.name_separator)
30
- the_parts = Array(parts).tap(&:compact!)
31
- the_parts.join(separator) if the_parts.any?
30
+ _join(parts, separator)
32
31
  end
33
32
 
34
33
  # Join the passed-in flags with the passed in separator.
@@ -37,8 +36,7 @@ module ObjectInspector
37
36
  # @param separator [#to_s] (ObjectInspector.configuration.flags_separator)
38
37
  def join_flags(flags,
39
38
  separator: ObjectInspector.configuration.flags_separator)
40
- the_flags = Array(flags).tap(&:compact!)
41
- the_flags.join(separator) if the_flags.any?
39
+ _join(flags, separator)
42
40
  end
43
41
 
44
42
  # Join the passed-in issues with the passed in separator.
@@ -47,8 +45,7 @@ module ObjectInspector
47
45
  # @param separator [#to_s] (ObjectInspector.configuration.issues_separator)
48
46
  def join_issues(issues,
49
47
  separator: ObjectInspector.configuration.issues_separator)
50
- the_issues = Array(issues).tap(&:compact!)
51
- the_issues.join(separator) if the_issues.any?
48
+ _join(issues, separator)
52
49
  end
53
50
 
54
51
  # Join the passed-in items with the passed in separator.
@@ -57,8 +54,7 @@ module ObjectInspector
57
54
  # @param separator [#to_s] (ObjectInspector.configuration.info_separator)
58
55
  def join_info(items,
59
56
  separator: ObjectInspector.configuration.info_separator)
60
- the_items = Array(items).tap(&:compact!)
61
- the_items.join(separator) if the_items.any?
57
+ _join(items, separator)
62
58
  end
63
59
 
64
60
  # Compare self with the passed in object.
@@ -108,6 +104,13 @@ module ObjectInspector
108
104
  end
109
105
  end
110
106
 
107
+ def _join(items, separator)
108
+ items = Array(items)
109
+ items.flatten!
110
+ items.compact!
111
+ items.join(separator) unless items.empty?
112
+ end
113
+
111
114
  def match?(scope_name)
112
115
  any_names_match?(scope_name) ||
113
116
  wild_card_scope?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ObjectInspector
4
- VERSION = "0.6.0"
4
+ VERSION = "0.6.2"
5
5
  end
@@ -7,8 +7,8 @@ require "object_inspector/version"
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = "object_inspector"
9
9
  spec.version = ObjectInspector::VERSION
10
- spec.authors = ["Paul Dobbins"]
11
- spec.email = ["paul.dobbins@icloud.com"]
10
+ spec.authors = ["Paul DobbinSchmaltz"]
11
+ spec.email = ["p.dobbinschmaltz@icloud.com"]
12
12
 
13
13
  spec.summary = "ObjectInspector builds uniformly formatted inspect output with customizable amounts of detail."
14
14
  spec.description = "ObjectInspector 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 represents objects. Great for the console, logging, etc."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: object_inspector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
- - Paul Dobbins
8
- autorequire:
7
+ - Paul DobbinSchmaltz
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-14 00:00:00.000000000 Z
11
+ date: 2022-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -183,7 +183,7 @@ description: ObjectInspector takes Object#inspect to the next level. Specify any
183
183
  self-definable scope option to represents objects. Great for the console, logging,
184
184
  etc.
185
185
  email:
186
- - paul.dobbins@icloud.com
186
+ - p.dobbinschmaltz@icloud.com
187
187
  executables: []
188
188
  extensions: []
189
189
  extra_rdoc_files: []
@@ -191,7 +191,6 @@ files:
191
191
  - ".gitignore"
192
192
  - ".rubocop"
193
193
  - ".rubocop.yml"
194
- - ".travis.yml"
195
194
  - CHANGELOG.md
196
195
  - Gemfile
197
196
  - Gemfile.lock
@@ -217,7 +216,7 @@ homepage: https://github.com/pdobb/object_inspector
217
216
  licenses:
218
217
  - MIT
219
218
  metadata: {}
220
- post_install_message:
219
+ post_install_message:
221
220
  rdoc_options: []
222
221
  require_paths:
223
222
  - lib
@@ -232,8 +231,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
231
  - !ruby/object:Gem::Version
233
232
  version: '0'
234
233
  requirements: []
235
- rubygems_version: 3.0.3
236
- signing_key:
234
+ rubygems_version: 3.3.3
235
+ signing_key:
237
236
  specification_version: 4
238
237
  summary: ObjectInspector builds uniformly formatted inspect output with customizable
239
238
  amounts of detail.
data/.travis.yml DELETED
@@ -1,21 +0,0 @@
1
- env:
2
- global:
3
- - CC_TEST_REPORTER_ID=7711465d4611bd7f1211f3262ac4ba750ffcda0574c3c6e4a6ba55446871dd17
4
- sudo: false
5
- language: ruby
6
- rvm:
7
- - 2.3
8
- - 2.4
9
- - 2.5
10
- - 2.6
11
- - ruby-head
12
- notifications:
13
- email: false
14
- before_install: gem install bundler -v 1.16.1
15
- cache: bundler
16
- before_script:
17
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
18
- - chmod +x ./cc-test-reporter
19
- - ./cc-test-reporter before-build
20
- after_script:
21
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT