object_inspector 0.6.0 → 0.6.1

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: 4b35f6663bb2960940d4c0139ff728c37082c86ffef6a2bfedeb179fcbb54339
4
+ data.tar.gz: 53e84daa5e170088aeeaac38845eab86f717dacbebf0d9e795e557cd2e5f0f75
5
5
  SHA512:
6
- metadata.gz: 0b31e59f84e625d766309ba1dd760a87bba5b70007214aeec3dd3f47c44e64446db34c640a5a9c35923881178eb61c98080138d542ba1fe1b632a93d1269b4ee
7
- data.tar.gz: 777ee932d2e9fa0c0d4c013dd9f0c8713956afafd883ce866fccb93f23b25fa8eaddb729b6035fd74c514bf9865f40bca09cb06fc2153a4f927458b7dbdbad45
6
+ metadata.gz: fe9fb99c6ed1b74f269070f697119596f0ec9cfe074453fbc77166349b813163158dbe6ccf58646b340f7a0fca8fdab391da1db17e75986e904eebfca96598d5
7
+ data.tar.gz: 65ed4a72973c2cd5b38b56af6cd131d35a6c2c3affc292be8e13e11eae6c222ad10585b4eee3a475d1888fcd4e98cc17c1c1d940ae535f25472b65e815f83759
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,12 @@
1
- ### 0.6.0 - 2019-03-13
2
- - Fix inspection of delegating wrapper objects
1
+ ### 0.6.1 - 2019-06-27
2
+ - Flatten and compact arrays of `nil`s as well as nested arrays of `nil`s in join_* methods.
3
3
 
4
+ ### 0.6.0 - 2019-03-13
5
+ - Fix inspection of delegating wrapper objects.
6
+ - Allow clearing output of inspect methods.
4
7
 
5
8
  ### 0.5.2 - 2019-02-24
6
- - Automatically compact nils in join_* methods
9
+ - Automatically compact nils in join_* methods.
7
10
 
8
11
  ### 0.5.1 - 2018-06-12
9
12
  - Don't include empty strings from Scope#join_* methods when applicable.
@@ -13,29 +16,23 @@
13
16
  - Add ObjectInspector::Scope#join_name.
14
17
  - Add configurable ObjectInspector.configuration.presented_object_separator.
15
18
 
16
-
17
19
  ### 0.4.0 - 2018-05-25
18
20
  - Feature: Add ObjectInspector::Configuration#default_scope setting -- can be used to override the default Scope for object inspection.
19
21
  - Implement ObjectInspector::Scope#== for comparing scopes with scopes and/or scopes with (Arrays of) Strings, Symbols, etc.
20
22
 
21
-
22
23
  ### 0.3.1 - 2018-04-15
23
24
  - Add ObjectInspector::Configuration#formatter_class setting for overriding the default Formatter.
24
25
 
25
-
26
26
  ### 0.3.0 - 2018-04-14
27
-
28
27
  - 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
28
  - Add ObjectInspector::Scope.join_flags helper method.
30
29
  - Add ObjectInspector::Scope.join_info helper method.
31
30
  - Scope: Show an out-of-scope-placeholder symbol (*) when predicate is not matched and a block is given.
32
31
  - 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])
32
+ - Add ability to specify multiple scopes. e.g. my_object.inspect(scope: %i[verbose complex]).
34
33
  - Add gem defaults configuration.
35
34
 
36
-
37
35
  ### 0.2.0 - 2018-04-12
38
-
39
36
  - Automatically inspect wrapped Objects, if applicable.
40
37
  - Use `display_name` if defined on object, in place of `inspect_name`.
41
38
  - Add on-the-fly inspect methods when Symbols are passed in to #inspect.
@@ -45,5 +42,4 @@
45
42
 
46
43
 
47
44
  ### 0.1.0 - 2018-04-09
48
-
49
45
  - Initial release!
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- object_inspector (0.6.0)
4
+ object_inspector (0.6.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -14,7 +14,7 @@ GEM
14
14
  thread_safe (~> 0.3, >= 0.3.1)
15
15
  benchmark-ips (2.7.2)
16
16
  builder (3.2.3)
17
- byebug (11.0.0)
17
+ byebug (11.0.1)
18
18
  codeclimate-engine-rb (0.4.1)
19
19
  virtus (~> 1.0)
20
20
  coderay (1.1.2)
@@ -22,10 +22,10 @@ GEM
22
22
  descendants_tracker (~> 0.0.1)
23
23
  descendants_tracker (0.0.4)
24
24
  thread_safe (~> 0.3, >= 0.3.1)
25
- docile (1.3.1)
25
+ docile (1.3.2)
26
26
  equalizer (0.0.11)
27
27
  ice_nine (0.11.2)
28
- jaro_winkler (1.5.2)
28
+ jaro_winkler (1.5.3)
29
29
  json (2.2.0)
30
30
  kwalify (0.7.2)
31
31
  method_source (0.9.2)
@@ -35,11 +35,10 @@ GEM
35
35
  builder
36
36
  minitest (>= 5.0)
37
37
  ruby-progressbar
38
- object_identifier (0.2.1)
39
- parallel (1.14.0)
40
- parser (2.6.0.0)
38
+ object_identifier (0.3.0)
39
+ parallel (1.17.0)
40
+ parser (2.6.3.0)
41
41
  ast (~> 2.4.0)
42
- powerpack (0.1.2)
43
42
  pry (0.12.2)
44
43
  coderay (~> 1.1.0)
45
44
  method_source (~> 0.9.0)
@@ -49,29 +48,27 @@ GEM
49
48
  psych (3.1.0)
50
49
  rainbow (3.0.0)
51
50
  rake (12.3.2)
52
- reek (5.3.1)
51
+ reek (5.4.0)
53
52
  codeclimate-engine-rb (~> 0.4.0)
54
53
  kwalify (~> 0.7.0)
55
54
  parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
56
55
  psych (~> 3.1.0)
57
56
  rainbow (>= 2.0, < 4.0)
58
- rubocop (0.65.0)
57
+ rubocop (0.72.0)
59
58
  jaro_winkler (~> 1.5.1)
60
59
  parallel (~> 1.10)
61
- parser (>= 2.5, != 2.5.1.1)
62
- powerpack (~> 0.1)
63
- psych (>= 3.1.0)
60
+ parser (>= 2.6)
64
61
  rainbow (>= 2.2.2, < 4.0)
65
62
  ruby-progressbar (~> 1.7)
66
- unicode-display_width (~> 1.4.0)
67
- ruby-progressbar (1.10.0)
63
+ unicode-display_width (>= 1.4.0, < 1.7)
64
+ ruby-progressbar (1.10.1)
68
65
  simplecov (0.16.1)
69
66
  docile (~> 1.1)
70
67
  json (>= 1.8, < 3)
71
68
  simplecov-html (~> 0.10.0)
72
69
  simplecov-html (0.10.2)
73
70
  thread_safe (0.3.6)
74
- unicode-display_width (1.4.1)
71
+ unicode-display_width (1.6.0)
75
72
  virtus (1.0.5)
76
73
  axiom-types (~> 0.1)
77
74
  coercible (~> 1.0)
data/README.md CHANGED
@@ -455,6 +455,28 @@ MyObject.new.inspect(info: :my_method2) # => "<MyObject Result2>"
455
455
  MyObject.new.inspect # => "<MyObject my_method2>"
456
456
  ```
457
457
 
458
+ ## Clearing Output for Specified Inspect Method
459
+
460
+ Pass `nil` to any inspect method type to not display it:
461
+
462
+ ```ruby
463
+ class MyObject
464
+ include ObjectInspector::InspectorsHelper
465
+
466
+ def inspect_identification; "My Object" end
467
+ def inspect_info; "INFO" end
468
+ def inspect_flags; "FLAG1" end
469
+ def inspect_issues; "ISSUE1" end
470
+ end
471
+
472
+ MyObject.new.inspect
473
+ # => "<My Object(FLAG1) !!ISSUE1!! INFO>"
474
+ MyObject.new.inspect(info: nil, flags: nil, issues: nil)
475
+ # => "<My Object>"
476
+ MyObject.new.inspect(identification: nil, info: nil, flags: nil, issues: nil)
477
+ # => "<MyObject>"
478
+ ```
479
+
458
480
 
459
481
  ## Custom Formatters
460
482
 
@@ -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.1"
5
5
  end
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Dobbins
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-14 00:00:00.000000000 Z
11
+ date: 2019-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
232
  - !ruby/object:Gem::Version
233
233
  version: '0'
234
234
  requirements: []
235
- rubygems_version: 3.0.3
235
+ rubygems_version: 3.0.4
236
236
  signing_key:
237
237
  specification_version: 4
238
238
  summary: ObjectInspector builds uniformly formatted inspect output with customizable