object_inspector 0.7.0 → 0.7.1
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/README.md +1 -0
- data/lib/object_inspector/inspectors_helper.rb +14 -2
- data/lib/object_inspector/version.rb +1 -1
- data/lib/object_inspector.rb +17 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66a1b54f20e570dfe382fe163d12f8df723c50c09349e61d9e18540553829d78
|
4
|
+
data.tar.gz: 8ecefc9bc3dd82c15370153982f6725053588a1e40a740c028c5014c9ecebda0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f54049cb8ddfa9b9dc6ec98e7372fd569eefe8f5a98c0408376f3395961129fc86f888cf03f5b31f9be94ea1f783c50c72888b18ae5fefb4f86f1e61310adea
|
7
|
+
data.tar.gz: 39c9e9e2dba1e99dbf790915c4593b1ec4f2e6dd013fa80e6ba9baca13b6b630c9543dd41f42796c5e4e5631063c81f173f43a62708e7706b6e03a6865b1f284
|
data/README.md
CHANGED
@@ -45,6 +45,7 @@ _Note: In a Rails app, the following would go in e.g. `config/initializers/objec
|
|
45
45
|
```ruby
|
46
46
|
# Default values are shown.
|
47
47
|
ObjectInspector.configure do |config|
|
48
|
+
config.enabled = true
|
48
49
|
config.formatter_class = ObjectInspector::TemplatingFormatter
|
49
50
|
config.inspect_method_prefix = "inspect"
|
50
51
|
config.default_scope = ObjectInspector::Scope.new(:self)
|
@@ -8,7 +8,19 @@ module ObjectInspector::InspectorsHelper
|
|
8
8
|
# passing it the passed in `kwargs` (keyword arguments).
|
9
9
|
#
|
10
10
|
# @return [String]
|
11
|
-
def inspect(
|
12
|
-
ObjectInspector
|
11
|
+
def inspect(**kwargs)
|
12
|
+
return super() if ObjectInspector.configuration.disabled?
|
13
|
+
|
14
|
+
ObjectInspector::Inspector.inspect(self, **kwargs)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
# :reek:UtilityFunction
|
20
|
+
|
21
|
+
# Allow ActiveRecord::Core#pretty_print to produce the standard Pretty-printed
|
22
|
+
# output (vs just straight #inspect String) when ObjectInspector is disabled.
|
23
|
+
def custom_inspect_method_defined?
|
24
|
+
ObjectInspector.configuration.enabled?
|
13
25
|
end
|
14
26
|
end
|
data/lib/object_inspector.rb
CHANGED
@@ -36,7 +36,8 @@ module ObjectInspector
|
|
36
36
|
:issues_separator,
|
37
37
|
:info_separator
|
38
38
|
|
39
|
-
def initialize
|
39
|
+
def initialize # rubocop:disable Metrics/MethodLength
|
40
|
+
@enabled = true
|
40
41
|
@formatter_class = TemplatingFormatter
|
41
42
|
@inspect_method_prefix = "inspect"
|
42
43
|
@default_scope = Scope.new(:self)
|
@@ -49,6 +50,21 @@ module ObjectInspector
|
|
49
50
|
@info_separator = " | "
|
50
51
|
end
|
51
52
|
|
53
|
+
def toggle = enabled? ? disable : enable
|
54
|
+
def enabled? = @enabled
|
55
|
+
|
56
|
+
def enable
|
57
|
+
@enabled = true
|
58
|
+
puts(" -> ObjectInspector enabled")
|
59
|
+
end
|
60
|
+
|
61
|
+
def disabled? = !enabled?
|
62
|
+
|
63
|
+
def disable
|
64
|
+
@enabled = false
|
65
|
+
puts(" -> ObjectInspector disabled")
|
66
|
+
end
|
67
|
+
|
52
68
|
def formatter_class=(value)
|
53
69
|
unless value.is_a?(Class)
|
54
70
|
raise TypeError, "Formatter must be a Class constant"
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: object_inspector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul DobbinSchmaltz
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: benchmark-ips
|
@@ -97,7 +96,6 @@ metadata:
|
|
97
96
|
source_code_uri: https://github.com/pdobb/object_inspector
|
98
97
|
homepage_uri: https://github.com/pdobb/object_inspector
|
99
98
|
rubygems_mfa_required: 'true'
|
100
|
-
post_install_message:
|
101
99
|
rdoc_options: []
|
102
100
|
require_paths:
|
103
101
|
- lib
|
@@ -112,8 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
110
|
- !ruby/object:Gem::Version
|
113
111
|
version: '0'
|
114
112
|
requirements: []
|
115
|
-
rubygems_version: 3.
|
116
|
-
signing_key:
|
113
|
+
rubygems_version: 3.7.2
|
117
114
|
specification_version: 4
|
118
115
|
summary: Object Inspector builds uniformly formatted inspect output with customizable
|
119
116
|
amounts of detail.
|