object_identifier 0.7.0 → 0.8.0

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: f93a767a479c1b5fccb0203eb79707479970876206c1325e567afe0792032d58
4
- data.tar.gz: 3c6508fa051abfce2c19001783e98658b9e183f8725e871044a67b5185042bf8
3
+ metadata.gz: 5b85174f7e95e1acad9f62da0d27dd867435668009aaf20d37a77de955835837
4
+ data.tar.gz: bbf1820134da13adc7bf0cc1ed41653afa63a0b0023b205d5b5179156227f202
5
5
  SHA512:
6
- metadata.gz: 3861571fbe466a526f9c10fe4c840ee51c7124998cf1009c81a9667c070cf1999362fa501b7030da795612b16ec81ff2f436a41613fd1256db614ecbecb46b34
7
- data.tar.gz: 9c8505f55368a9cb64e0d8bcee68f2b5de7f0a4346a227d75d8d93465072da0d027b888789a6da90aef86867399546ac27c1a63eb945d6778050a6df46bd8bb8
6
+ metadata.gz: 0beefb1a00fe450580879bcd8b1095f30a412eaa2b6a32033c614753b828eb6a4bb96e5d891935666d82cde9233bf73c010162d9bccb345a4946ab4f4e7f2833
7
+ data.tar.gz: 48b59efffdb83a460f471d6ba957b6ba3166b3aaf6cc1b19d7d17afd4a274b607de02a4f853f51806489f56de77bfaa4c2cc2461665f8dd5bee61f8dd4b27145
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2023 Paul DobbinSchmaltz
3
+ Copyright (c) 2024 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,6 +1,7 @@
1
1
  # Object Identifier
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/object_identifier.svg)](https://badge.fury.io/rb/object_identifier)
3
+ [![Gem Version](https://img.shields.io/github/v/release/pdobb/object_identifier)](https://img.shields.io/github/v/release/pdobb/object_identifier)
4
+ [![CI Actions](https://github.com/pdobb/object_identifier/actions/workflows/ci.yml/badge.svg)](https://github.com/pdobb/object_identifier/actions)
4
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/0b737a72d16ec755c1ff/maintainability)](https://codeclimate.com/github/pdobb/object_identifier/maintainability)
5
6
 
6
7
  Object Identifier allows quick, easy, and uniform identification of an object by inspecting its class name and outputting any desirable attributes/methods. It is great for logging, sending descriptive notification messages, etc.
@@ -17,7 +18,6 @@ Which is the same as:
17
18
  "#{some_object.class.name}[id:#{some_object.id}, name:\"#{some_object.name}\"]"
18
19
  ```
19
20
 
20
-
21
21
  ## Installation
22
22
 
23
23
  Add this line to your application's Gemfile:
@@ -34,14 +34,19 @@ Or install it yourself as:
34
34
 
35
35
  $ gem install object_identifier
36
36
 
37
-
38
37
  ## Compatibility
39
38
 
40
39
  Tested MRI Ruby Versions:
41
- * 2.7
42
- * 3.0
43
- * 3.1
44
- * 3.2
40
+
41
+ - 3.1
42
+ - 3.2
43
+ - 3.3
44
+
45
+ Note: For Ruby 2.7 or 3.1 support, install object_identifier gem version 0.7.0.
46
+
47
+ ```ruby
48
+ gem "object_identifier", "0.7.0"
49
+ ```
45
50
 
46
51
  Object Identifier has no other dependencies.
47
52
 
@@ -59,7 +64,6 @@ ObjectIdentifier.configure do |config|
59
64
  end
60
65
  ```
61
66
 
62
-
63
67
  ## Usage
64
68
 
65
69
  ### Defaults
@@ -122,7 +126,6 @@ The number of results that will be identified from a collection can be truncated
122
126
  # => Movie[id:1, name:"Pi"], ... (1 more)
123
127
  ```
124
128
 
125
-
126
129
  ### Empty Collections
127
130
 
128
131
  ```ruby
@@ -130,7 +133,6 @@ The number of results that will be identified from a collection can be truncated
130
133
  {}.identify # => [no objects]
131
134
  ```
132
135
 
133
-
134
136
  ## Custom Object Identifiers
135
137
 
136
138
  Internally, Object Identifier calls `inspect_lit` to return a "literally-inspected" string representation of an object. This works because Object, itself, is monkey-patched to define `inspect_lit` which just returns `inspect`. This is sufficient for most objects, but some objects will benefit from defining special output from `inspect_lit`.
@@ -161,53 +163,75 @@ OpenStruct.new(my_value: my_value_object).identify(:my_value)
161
163
  # => "OpenStruct[my_value:42 Meters]"
162
164
  ```
163
165
 
164
-
165
166
  ## Supporting Gems
166
167
 
167
168
  Object Identifier works great with the [Object Inspector](https://github.com/pdobb/object_inspector) gem.
168
169
 
169
-
170
170
  ### Benchmarking Formatters
171
171
 
172
- Performance of Formatters can be tested by playing the [Formatters Benchmarking Scripts](https://github.com/pdobb/object_identifier/blob/master/script/benchmarking/formatters.rb) in the pry console for this gem.
172
+ Performance of Formatters can be tested by playing the [Formatters Benchmarking Scripts](https://github.com/pdobb/object_identifier/blob/master/script/benchmarking/formatters.rb) in the IRB console for this gem.
173
173
 
174
- Custom Formatters may be similarly gauged for comparison by adding them to the `custom_formatter_klasses` array before playing the script.
174
+ Custom Formatters may be similarly gauged for comparison by adding them to the `custom_formatter_klasses` array before playing (loading) the script.
175
175
 
176
176
  ```ruby
177
177
  custom_formatter_klasses = [MyCustomFormatter]
178
178
 
179
- play script/benchmarking/formatters.rb
179
+ load "script/benchmarking/formatters.rb"
180
180
  # ObjectIdentifier::StringFormatter
181
181
  # 58.478k (± 0.8%) i/s - 295.776k in 5.058178s
182
182
  # MyCustomFormatter
183
183
  # ...
184
184
  ```
185
185
 
186
-
187
186
  ## Development
188
187
 
189
188
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. Or, run `rake` to run the tests plus linters as well as `yard` (to confirm proper YARD documentation practices). You can also run `bin/console` for an interactive prompt that will allow you to experiment.
190
189
 
191
190
  To install this gem onto your local machine, run `bundle exec rake install`.
192
191
 
193
- To release a new version, update the version number in `version.rb`, bump the latest ruby target versions etc. with `rake bump`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
192
+ ### Testing
194
193
 
194
+ To test this gem (gemwork):
195
+
196
+ ```bash
197
+ rake
198
+ ```
199
+
200
+ #### Linters
201
+
202
+ ```bash
203
+ rubocop
204
+
205
+ reek
206
+
207
+ npx prettier . --check
208
+ npx prettier . --write
209
+ ```
210
+
211
+ ### Releases
212
+
213
+ To release a new version of Gemwork to RubyGems:
214
+
215
+ 1. Update the version number in `version.rb`
216
+ 2. Update `CHANGELOG.md`
217
+ 3. Run `bundle` to update Gemfile.lock with the latest version info
218
+ 4. Commit the changes. e.g. `Bump to vX.Y.Z`
219
+ 5. Run `rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
195
220
 
196
221
  ### Documentation
197
222
 
198
223
  [YARD documentation](https://yardoc.org/index.html) can be generated and viewed live:
224
+
199
225
  1. Install YARD: `gem install yard`
200
226
  2. Run the YARD server: `yard server --reload`
201
227
  3. Open the live documentation site: `open http://localhost:8808`
202
228
 
203
229
  While the YARD server is running, documentation in the live site will be auto-updated on source code save (and site reload).
204
230
 
205
-
206
231
  ## Contributing
207
232
 
208
233
  Bug reports and pull requests are welcome on GitHub at https://github.com/pdobb/object_identifier.
209
234
 
210
-
211
235
  ## License
212
236
 
213
237
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -4,7 +4,7 @@
4
4
  # Array.wrap method. This allows us to get around objects that respond to
5
5
  # `to_a` (such as Struct) and, instead, either utilize `to_ary` or just
6
6
  # actually wrap the object in an Array ourselves.
7
- class ObjectIdentifier::ArrayWrap
7
+ module ObjectIdentifier::ArrayWrap
8
8
  # :reek:NilCheck
9
9
  # :reek:ManualDispatch
10
10
 
@@ -51,7 +51,7 @@ class ObjectIdentifier::StringFormatter < ObjectIdentifier::BaseFormatter
51
51
  #
52
52
  # @return [String]
53
53
  def call
54
- parts = objects.first(limit).map { |obj| format_item(obj) }
54
+ parts = objects.first(limit).map! { |obj| format_item(obj) }
55
55
  parts << "... (#{truncated_objects_count} more)" if truncated?
56
56
  parts.join(", ")
57
57
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module ObjectIdentifier
4
4
  # The current ObjectIdentifier gem version.
5
- VERSION = "0.7.0"
5
+ VERSION = "0.8.0"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: object_identifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul DobbinSchmaltz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-21 00:00:00.000000000 Z
11
+ date: 2024-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -25,105 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: byebug
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: minitest
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: minitest-reporters
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: much-stub
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: pdobb-style
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: pry
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: pry-byebug
28
+ name: gemwork
127
29
  requirement: !ruby/object:Gem::Requirement
128
30
  requirements:
129
31
  - - ">="
@@ -150,48 +52,6 @@ dependencies:
150
52
  - - ">="
151
53
  - !ruby/object:Gem::Version
152
54
  version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: reek
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
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'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: '0'
181
- - !ruby/object:Gem::Dependency
182
- name: solargraph
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- version: '0'
188
- type: :development
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: '0'
195
55
  description: Object Identifier allows quick, easy, and uniform identification of an
196
56
  object by inspecting its class name and outputting any desirable attributes/methods.
197
57
  It is great for logging, sending descriptive notification messages, etc.
@@ -232,14 +92,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
92
  requirements:
233
93
  - - ">="
234
94
  - !ruby/object:Gem::Version
235
- version: '2.7'
95
+ version: '3.1'
236
96
  required_rubygems_version: !ruby/object:Gem::Requirement
237
97
  requirements:
238
98
  - - ">="
239
99
  - !ruby/object:Gem::Version
240
100
  version: '0'
241
101
  requirements: []
242
- rubygems_version: 3.4.10
102
+ rubygems_version: 3.3.27
243
103
  signing_key:
244
104
  specification_version: 4
245
105
  summary: Object Identifier identifies an object by its class name and attributes.