object_inspector 0.7.1 → 0.8.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/LICENSE.txt +1 -1
- data/README.md +23 -8
- data/lib/object_inspector/inspectors_helper.rb +2 -14
- data/lib/object_inspector/version.rb +1 -1
- data/lib/object_inspector.rb +1 -17
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 46375ea86105e9cb191d0ba2c90d56a950cf6179089c735d6191371e035d1c1d
|
|
4
|
+
data.tar.gz: bd1965e84b3ceab6673df8e300604a37910be007031fbfc14f305b3105b0d7c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21225b2857499c836b7055293ed60182b20504ddc308415179364aebc9024c12b03b083cf8601717b27fb318b3e1b4f06788decc2a6666a8c85b67c95802db0e
|
|
7
|
+
data.tar.gz: 7f75c140f1b66be107f667eb94e16fb59a9c40c884e4ac7fab0cffb124cb0492302a2f004ed5d82e03edd33a5ff714e8adbb97560f87a37a11576cffb064014e
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://img.shields.io/github/v/release/pdobb/object_inspector)
|
|
4
4
|
[](https://github.com/pdobb/object_inspector/actions)
|
|
5
|
-
[](https://codeclimate.com/github/pdobb/object_inspector/maintainability)
|
|
6
5
|
|
|
7
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.
|
|
8
7
|
|
|
@@ -30,9 +29,21 @@ Or install it yourself:
|
|
|
30
29
|
|
|
31
30
|
Tested MRI Ruby Versions:
|
|
32
31
|
|
|
33
|
-
- 3.1
|
|
34
32
|
- 3.2
|
|
35
33
|
- 3.3
|
|
34
|
+
- 3.4
|
|
35
|
+
|
|
36
|
+
For Ruby 2.7 support, install object_inspector gem version 0.6.3.
|
|
37
|
+
|
|
38
|
+
```ruby
|
|
39
|
+
gem "object_inspector", "0.6.3"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For Ruby 3.1 support, install object_inspector gem version 0.7.0.
|
|
43
|
+
|
|
44
|
+
```ruby
|
|
45
|
+
gem "object_inspector", "0.6.3"
|
|
46
|
+
```
|
|
36
47
|
|
|
37
48
|
Object Inspector has no other dependencies.
|
|
38
49
|
|
|
@@ -45,7 +56,6 @@ _Note: In a Rails app, the following would go in e.g. `config/initializers/objec
|
|
|
45
56
|
```ruby
|
|
46
57
|
# Default values are shown.
|
|
47
58
|
ObjectInspector.configure do |config|
|
|
48
|
-
config.enabled = true
|
|
49
59
|
config.formatter_class = ObjectInspector::TemplatingFormatter
|
|
50
60
|
config.inspect_method_prefix = "inspect"
|
|
51
61
|
config.default_scope = ObjectInspector::Scope.new(:self)
|
|
@@ -228,9 +238,14 @@ scope.complex? { "MATCH" } # => "*"
|
|
|
228
238
|
### Scope Joiners
|
|
229
239
|
|
|
230
240
|
ObjectInspector::Scope also offers helper methods for uniformly joining inspect elements:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
241
|
+
|
|
242
|
+
```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
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
For example:
|
|
234
249
|
|
|
235
250
|
```ruby
|
|
236
251
|
scope = ObjectInspector::Scope.new(:verbose)
|
|
@@ -584,7 +599,7 @@ To install this gem onto your local machine, run `bundle exec rake install`.
|
|
|
584
599
|
|
|
585
600
|
### Testing
|
|
586
601
|
|
|
587
|
-
To test this gem
|
|
602
|
+
To test this gem:
|
|
588
603
|
|
|
589
604
|
```bash
|
|
590
605
|
rake
|
|
@@ -603,7 +618,7 @@ npx prettier . --write
|
|
|
603
618
|
|
|
604
619
|
### Releases
|
|
605
620
|
|
|
606
|
-
To release a new version of
|
|
621
|
+
To release a new version of this gem to RubyGems:
|
|
607
622
|
|
|
608
623
|
1. Update the version number in `version.rb`
|
|
609
624
|
2. Update `CHANGELOG.md`
|
|
@@ -8,19 +8,7 @@ module ObjectInspector::InspectorsHelper
|
|
|
8
8
|
# passing it the passed in `kwargs` (keyword arguments).
|
|
9
9
|
#
|
|
10
10
|
# @return [String]
|
|
11
|
-
def inspect(
|
|
12
|
-
|
|
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?
|
|
11
|
+
def inspect(object = self, ...)
|
|
12
|
+
ObjectInspector::Inspector.inspect(object, ...)
|
|
25
13
|
end
|
|
26
14
|
end
|
data/lib/object_inspector.rb
CHANGED
|
@@ -36,8 +36,7 @@ module ObjectInspector
|
|
|
36
36
|
:issues_separator,
|
|
37
37
|
:info_separator
|
|
38
38
|
|
|
39
|
-
def initialize
|
|
40
|
-
@enabled = true
|
|
39
|
+
def initialize
|
|
41
40
|
@formatter_class = TemplatingFormatter
|
|
42
41
|
@inspect_method_prefix = "inspect"
|
|
43
42
|
@default_scope = Scope.new(:self)
|
|
@@ -50,21 +49,6 @@ module ObjectInspector
|
|
|
50
49
|
@info_separator = " | "
|
|
51
50
|
end
|
|
52
51
|
|
|
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
|
-
|
|
68
52
|
def formatter_class=(value)
|
|
69
53
|
unless value.is_a?(Class)
|
|
70
54
|
raise TypeError, "Formatter must be a Class constant"
|
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.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Paul DobbinSchmaltz
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2025-01-04 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.
|
|
113
|
+
rubygems_version: 3.6.2
|
|
114
114
|
specification_version: 4
|
|
115
115
|
summary: Object Inspector builds uniformly formatted inspect output with customizable
|
|
116
116
|
amounts of detail.
|