cool_id 0.1.8 → 0.2.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/.yardopts +5 -0
- data/README.md +47 -12
- data/lib/cool_id/version.rb +1 -1
- data/lib/cool_id.rb +137 -12
- metadata +76 -23
- data/.aider.conf.yml +0 -9
- data/.rspec +0 -3
- data/.standard.yml +0 -3
- data/Rakefile +0 -10
- data/sig/cool_id.rbs +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc42cbe218faf0128cc6e5c4f35c1b5eb2726dc0f1fcdf28cf5815593b34f5dd
|
4
|
+
data.tar.gz: df7b2bafa9b1981727109d9eed23041c32e010df7e6a578f90594727606d45be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d0fc47f2c3d94877fc3c79480e674b2c57a585623c0ed9d6fecb8d72cb3b3770062304055c794ccb012e34c00aef2a9bd9f7941ff8031198fd73eaaa9949a4c
|
7
|
+
data.tar.gz: 071f5e82664f7915b95f1be643da9dd10b89c81830d71a41d31bc302e4e156482ab38595c69ca9f0d53632987024a91a715423ec54eb2c4bbb3fc407893c98eb
|
data/.yardopts
ADDED
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# cool id
|
2
2
|
|
3
|
-
gem for rails apps to
|
3
|
+
gem for rails apps to generate string ids with a prefix, followed by a [nanoid](https://zelark.github.io/nano-id-cc/). similar to the ids you see in stripe's api. also able to lookup any record by id, similar to rails' globalid. there's an [introductory blog post](https://schpet.com/note/cool-id) explaining why i made this.
|
4
|
+
|
5
|
+
## usage
|
6
|
+
|
7
|
+
### basic id generation
|
4
8
|
|
5
9
|
```ruby
|
6
10
|
class User < ActiveRecord::Base
|
@@ -12,14 +16,23 @@ User.create!(name: "...").id
|
|
12
16
|
# => "usr_vktd1b5v84lr"
|
13
17
|
```
|
14
18
|
|
15
|
-
|
19
|
+
### locate records
|
16
20
|
|
17
21
|
```ruby
|
18
22
|
CoolId.locate("usr_vktd1b5v84lr")
|
19
23
|
# => #<User id: "usr_vktd1b5v84lr", name: "John Doe">
|
20
24
|
```
|
21
25
|
|
22
|
-
|
26
|
+
### generate ids
|
27
|
+
|
28
|
+
e.g. for batch inserts or upserts
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
User.generate_cool_id
|
32
|
+
# => "usr_vktd1b5v84lr"
|
33
|
+
```
|
34
|
+
|
35
|
+
### parsing ids
|
23
36
|
|
24
37
|
```ruby
|
25
38
|
parsed = CoolId.parse("usr_vktd1b5v84lr")
|
@@ -29,14 +42,7 @@ parsed.model_class
|
|
29
42
|
# => User
|
30
43
|
```
|
31
44
|
|
32
|
-
|
33
|
-
|
34
|
-
```ruby
|
35
|
-
# generate an id, e.g. for batch inserts or upserts
|
36
|
-
User.generate_cool_id
|
37
|
-
# => "usr_vktd1b5v84lr"
|
38
|
-
|
39
|
-
```
|
45
|
+
### configuration options
|
40
46
|
|
41
47
|
it takes parameters to change the alphabet or length
|
42
48
|
|
@@ -60,6 +66,27 @@ CoolId.configure do |config|
|
|
60
66
|
end
|
61
67
|
```
|
62
68
|
|
69
|
+
#### using a different id field
|
70
|
+
|
71
|
+
you can use cool_id with a separate field, keeping the default primary key:
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
class Product < ActiveRecord::Base
|
75
|
+
include CoolId::Model
|
76
|
+
cool_id prefix: "prd", id_field: :public_id
|
77
|
+
end
|
78
|
+
|
79
|
+
product = Product.create!(name: "Cool Product")
|
80
|
+
product.id # => 1 (or a uuid or whatever primary key you like)
|
81
|
+
product.public_id # => "prd_vktd1b5v84lr"
|
82
|
+
|
83
|
+
# locate will find this
|
84
|
+
CoolId.locate("prd_vktd1b5v84lr") # => #<Product id: 1, public_id: "prd_vktd1b5v84lr", ...>
|
85
|
+
```
|
86
|
+
|
87
|
+
this approach allows you to avoid exposing your primary keys, read David Bryant Copeland's [Create public-facing unique keys alongside your primary keys](https://naildrivin5.com/blog/2024/08/26/create-public-facing-unique-keys-alongside-your-primary-keys.html) to learn why you might want to do this. it also allows you to adopt cool_id more easily in a project that already has some data.
|
88
|
+
|
89
|
+
|
63
90
|
## installation
|
64
91
|
|
65
92
|
add cool_id to your Gemfile:
|
@@ -72,6 +99,13 @@ bundle add cool_id
|
|
72
99
|
gem "cool_id"
|
73
100
|
```
|
74
101
|
|
102
|
+
don't want to deal with a dependency? copy it into your project:
|
103
|
+
|
104
|
+
```
|
105
|
+
mkdir -p app/lib
|
106
|
+
curl https://raw.githubusercontent.com/schpet/cool_id/main/lib/cool_id.rb -o app/lib/cool_id.rb
|
107
|
+
```
|
108
|
+
|
75
109
|
### adding cool_id to a single model
|
76
110
|
|
77
111
|
use string ids when creating a table
|
@@ -91,6 +125,8 @@ class User < ActiveRecord::Base
|
|
91
125
|
end
|
92
126
|
```
|
93
127
|
|
128
|
+
note: if you prefer more traditional primary keys (like bigints or uuids) you can use the `id_field` on a different column.
|
129
|
+
|
94
130
|
### using cool_id on all models
|
95
131
|
|
96
132
|
you have drank the coolaid. setup rails to use string ids on all new generated migrations
|
@@ -117,7 +153,6 @@ end
|
|
117
153
|
|
118
154
|
if you use the graphql ruby node interface, you can implement [object identification](https://graphql-ruby.org/schema/object_identification)
|
119
155
|
|
120
|
-
|
121
156
|
```ruby
|
122
157
|
# app/graphql/app_schema.rb
|
123
158
|
class AppSchema < GraphQL::Schema
|
data/lib/cool_id/version.rb
CHANGED
data/lib/cool_id.rb
CHANGED
@@ -1,40 +1,76 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "cool_id/version"
|
4
|
-
require "
|
4
|
+
require "securerandom"
|
5
5
|
require "active_support/concern"
|
6
6
|
|
7
|
+
# The CoolId module provides functionality for generating and managing unique identifiers.
|
7
8
|
module CoolId
|
9
|
+
# Error raised when CoolId is not configured for a model.
|
8
10
|
class NotConfiguredError < StandardError; end
|
9
11
|
|
12
|
+
# Error raised when the maximum number of retries is exceeded while generating a unique ID.
|
10
13
|
class MaxRetriesExceededError < StandardError; end
|
11
14
|
|
12
|
-
#
|
15
|
+
# Default separator used in generated IDs.
|
13
16
|
DEFAULT_SEPARATOR = "_"
|
17
|
+
|
18
|
+
# Default alphabet used for generating IDs.
|
14
19
|
DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"
|
20
|
+
|
21
|
+
# Default length of the generated ID (excluding prefix and separator).
|
15
22
|
DEFAULT_LENGTH = 12
|
23
|
+
|
24
|
+
# Default maximum number of retries when generating a unique ID.
|
16
25
|
DEFAULT_MAX_RETRIES = 1000
|
17
26
|
|
18
|
-
|
27
|
+
# Struct representing a parsed CoolId.
|
28
|
+
# @attr [String] key The unique part of the ID (excluding prefix and separator).
|
29
|
+
# @attr [String] prefix The prefix of the ID.
|
30
|
+
# @attr [String] id The full ID (prefix + separator + key).
|
31
|
+
# @attr [Class] model_class The ActiveRecord model class associated with this ID.
|
32
|
+
# @attr [Symbol] id_field The field in the model used to store the ID.
|
33
|
+
Id = Struct.new(:key, :prefix, :id, :model_class, :id_field)
|
19
34
|
|
20
35
|
class << self
|
21
|
-
|
22
|
-
|
36
|
+
# @!attribute [rw] separator
|
37
|
+
# @return [String] The separator used in generated IDs.
|
38
|
+
# @!attribute [rw] alphabet
|
39
|
+
# @return [String] The alphabet used for generating IDs.
|
40
|
+
# @!attribute [rw] length
|
41
|
+
# @return [Integer] The length of the generated ID (excluding prefix and separator).
|
42
|
+
# @!attribute [rw] max_retries
|
43
|
+
# @return [Integer] The maximum number of retries when generating a unique ID.
|
44
|
+
# @!attribute [rw] id_field
|
45
|
+
# @return [Symbol, nil] The default field to use for storing the ID in models.
|
46
|
+
attr_accessor :separator, :alphabet, :length, :max_retries, :id_field
|
47
|
+
|
48
|
+
# Configures the CoolId module.
|
49
|
+
# @yield [self] Gives itself to the block.
|
50
|
+
# @return [void]
|
23
51
|
def configure
|
24
52
|
yield self
|
25
53
|
end
|
26
54
|
|
55
|
+
# Resets the configuration to default values.
|
56
|
+
# @return [void]
|
27
57
|
def reset_configuration
|
28
58
|
self.separator = DEFAULT_SEPARATOR
|
29
59
|
self.alphabet = DEFAULT_ALPHABET
|
30
60
|
self.length = DEFAULT_LENGTH
|
31
61
|
self.max_retries = DEFAULT_MAX_RETRIES
|
62
|
+
self.id_field = nil
|
32
63
|
end
|
33
64
|
|
65
|
+
# @return [Registry] The default registry that keeps track of which prefixes are associated with which model classes.
|
34
66
|
def registry
|
35
67
|
@prefix_map ||= Registry.new
|
36
68
|
end
|
37
69
|
|
70
|
+
# Generates a unique ID based on the given configuration.
|
71
|
+
# @param config [Config] The configuration for ID generation.
|
72
|
+
# @return [String] A unique ID.
|
73
|
+
# @raise [MaxRetriesExceededError] If unable to generate a unique ID within the maximum number of retries.
|
38
74
|
def generate_id(config)
|
39
75
|
alphabet = config.alphabet || @alphabet
|
40
76
|
length = config.length || @length
|
@@ -42,7 +78,7 @@ module CoolId
|
|
42
78
|
|
43
79
|
retries = 0
|
44
80
|
loop do
|
45
|
-
nano_id =
|
81
|
+
nano_id = SecureRandom.alphanumeric(length, chars: alphabet.chars)
|
46
82
|
full_id = "#{config.prefix}#{separator}#{nano_id}"
|
47
83
|
if !config.model_class.exists?(id: full_id)
|
48
84
|
return full_id
|
@@ -54,6 +90,13 @@ module CoolId
|
|
54
90
|
end
|
55
91
|
end
|
56
92
|
end
|
93
|
+
|
94
|
+
# Resolves the field (column) to use for storing the CoolId in a model.
|
95
|
+
# @param model_class [Class] The ActiveRecord model class.
|
96
|
+
# @return [Symbol] The field to use for storing the CoolId.
|
97
|
+
def resolve_cool_id_field(model_class)
|
98
|
+
model_class.cool_id_config&.id_field || CoolId.id_field || model_class.primary_key
|
99
|
+
end
|
57
100
|
end
|
58
101
|
|
59
102
|
self.separator = DEFAULT_SEPARATOR
|
@@ -61,47 +104,95 @@ module CoolId
|
|
61
104
|
self.length = DEFAULT_LENGTH
|
62
105
|
self.max_retries = DEFAULT_MAX_RETRIES
|
63
106
|
|
107
|
+
# Registry for managing prefixes and model classes.
|
64
108
|
class Registry
|
65
109
|
def initialize
|
66
110
|
@prefix_map = {}
|
67
111
|
end
|
68
112
|
|
113
|
+
# Registers a prefix with a model class.
|
114
|
+
# @param prefix [String] The prefix to register.
|
115
|
+
# @param model_class [Class] The ActiveRecord model class to associate with the prefix.
|
116
|
+
# @return [void]
|
69
117
|
def register(prefix, model_class)
|
70
118
|
@prefix_map[prefix] = model_class
|
71
119
|
end
|
72
120
|
|
121
|
+
# Locates a record by its CoolId.
|
122
|
+
# @param id [String] The CoolId to look up.
|
123
|
+
# @return [ActiveRecord::Base, nil] The found record, or nil if not found.
|
73
124
|
def locate(id)
|
74
125
|
parsed = parse(id)
|
75
|
-
parsed
|
126
|
+
return nil unless parsed
|
127
|
+
|
128
|
+
id_field = CoolId.resolve_cool_id_field(parsed.model_class)
|
129
|
+
parsed.model_class.find_by(id_field => id)
|
76
130
|
end
|
77
131
|
|
132
|
+
# Parses a CoolId into its components.
|
133
|
+
# @param id [String] The CoolId to parse.
|
134
|
+
# @return [Id, nil] The parsed Id object, or nil if parsing fails.
|
78
135
|
def parse(id)
|
79
136
|
prefix, key = id.split(CoolId.separator, 2)
|
80
137
|
model_class = @prefix_map[prefix]
|
81
138
|
return nil unless model_class
|
82
|
-
|
139
|
+
id_field = CoolId.resolve_cool_id_field(model_class)
|
140
|
+
Id.new(key, prefix, id, model_class, id_field)
|
83
141
|
end
|
84
142
|
end
|
85
143
|
|
144
|
+
# Configuration class for CoolId generation.
|
86
145
|
class Config
|
87
|
-
|
146
|
+
# @return [String] The prefix for generated IDs.
|
147
|
+
attr_reader :prefix
|
88
148
|
|
89
|
-
|
90
|
-
|
149
|
+
# @return [Integer, nil] The length of the generated ID (excluding prefix and separator).
|
150
|
+
attr_reader :length
|
151
|
+
|
152
|
+
# @return [String, nil] The alphabet to use for generating IDs.
|
153
|
+
attr_reader :alphabet
|
154
|
+
|
155
|
+
# @return [Integer, nil] The maximum number of retries when generating a unique ID.
|
156
|
+
attr_reader :max_retries
|
157
|
+
|
158
|
+
# @return [Class] The ActiveRecord model class associated with this configuration.
|
159
|
+
attr_reader :model_class
|
160
|
+
|
161
|
+
# @return [Symbol, nil] The field to use for storing the ID in the model.
|
162
|
+
attr_reader :id_field
|
163
|
+
|
164
|
+
# Initializes a new Config instance.
|
165
|
+
# @param prefix [String] The prefix for generated IDs.
|
166
|
+
# @param model_class [Class] The ActiveRecord model class.
|
167
|
+
# @param length [Integer, nil] The length of the generated ID (excluding prefix and separator).
|
168
|
+
# @param alphabet [String, nil] The alphabet to use for generating IDs.
|
169
|
+
# @param max_retries [Integer, nil] The maximum number of retries when generating a unique ID.
|
170
|
+
# @param id_field [Symbol, nil] The field to use for storing the ID in the model.
|
171
|
+
def initialize(prefix:, model_class:, length: nil, alphabet: nil, max_retries: nil, id_field: nil)
|
91
172
|
@prefix = validate_prefix(prefix)
|
173
|
+
@length = length
|
92
174
|
@alphabet = validate_alphabet(alphabet)
|
93
175
|
@max_retries = max_retries
|
94
176
|
@model_class = model_class
|
177
|
+
@id_field = id_field
|
95
178
|
end
|
96
179
|
|
97
180
|
private
|
98
181
|
|
182
|
+
# Validates the prefix.
|
183
|
+
# @param value [String] The prefix to validate.
|
184
|
+
# @return [String] The validated prefix.
|
185
|
+
# @raise [ArgumentError] If the prefix is nil or empty.
|
99
186
|
def validate_prefix(value)
|
100
187
|
raise ArgumentError, "Prefix cannot be nil" if value.nil?
|
101
188
|
raise ArgumentError, "Prefix cannot be empty" if value.empty?
|
102
189
|
value
|
103
190
|
end
|
104
191
|
|
192
|
+
# Validates the alphabet.
|
193
|
+
# @param value [String, nil] The alphabet to validate.
|
194
|
+
# @return [String, nil] The validated alphabet.
|
195
|
+
# @raise [ArgumentError] If the alphabet includes the separator.
|
105
196
|
def validate_alphabet(value)
|
106
197
|
return nil if value.nil?
|
107
198
|
raise ArgumentError, "Alphabet cannot include the separator '#{CoolId.separator}'" if value.include?(CoolId.separator)
|
@@ -109,30 +200,52 @@ module CoolId
|
|
109
200
|
end
|
110
201
|
end
|
111
202
|
|
203
|
+
# Module to be included in ActiveRecord models for CoolId functionality.
|
112
204
|
module Model
|
113
205
|
extend ActiveSupport::Concern
|
114
206
|
|
115
207
|
class_methods do
|
208
|
+
# @!attribute [rw] cool_id_config
|
209
|
+
# @return [Config] The CoolId configuration for this model.
|
210
|
+
# @!attribute [rw] cool_id_setup_required
|
211
|
+
# @return [Boolean] Whether CoolId setup is required for this model.
|
116
212
|
attr_accessor :cool_id_config
|
117
213
|
attr_accessor :cool_id_setup_required
|
118
214
|
|
215
|
+
# Configures CoolId for this model.
|
216
|
+
# @param options [Hash] Options for configuring CoolId.
|
217
|
+
# @option options [String] :prefix The prefix for generated IDs.
|
218
|
+
# @option options [Integer] :length The length of the generated ID (excluding prefix and separator).
|
219
|
+
# @option options [String] :alphabet The alphabet to use for generating IDs.
|
220
|
+
# @option options [Integer] :max_retries The maximum number of retries when generating a unique ID.
|
221
|
+
# @option options [Symbol] :id_field The field to use for storing the ID in the model.
|
222
|
+
# @return [void]
|
119
223
|
def cool_id(options)
|
120
224
|
@cool_id_config = Config.new(**options, model_class: self)
|
121
225
|
CoolId.registry.register(options[:prefix], self)
|
122
226
|
end
|
123
227
|
|
228
|
+
# Generates a new CoolId for this model.
|
229
|
+
# @return [String] A new CoolId.
|
124
230
|
def generate_cool_id
|
125
231
|
CoolId.generate_id(@cool_id_config)
|
126
232
|
end
|
127
233
|
|
234
|
+
# Enforces CoolId setup for all descendants of this model.
|
235
|
+
# @return [void]
|
128
236
|
def enforce_cool_id_for_descendants
|
129
237
|
@cool_id_setup_required = true
|
130
238
|
end
|
131
239
|
|
240
|
+
# Skips enforcing CoolId setup for this model.
|
241
|
+
# @return [void]
|
132
242
|
def skip_enforce_cool_id
|
133
243
|
@cool_id_setup_required = false
|
134
244
|
end
|
135
245
|
|
246
|
+
# Inherits CoolId setup requirements to subclasses.
|
247
|
+
# @param subclass [Class] The subclass inheriting from this model.
|
248
|
+
# @return [void]
|
136
249
|
def inherited(subclass)
|
137
250
|
super
|
138
251
|
if @cool_id_setup_required && !subclass.instance_variable_defined?(:@cool_id_setup_required)
|
@@ -147,10 +260,16 @@ module CoolId
|
|
147
260
|
|
148
261
|
private
|
149
262
|
|
263
|
+
# Sets the CoolId for the model instance before creation.
|
264
|
+
# @return [void]
|
150
265
|
def set_cool_id
|
151
|
-
|
266
|
+
id_field = CoolId.resolve_cool_id_field(self.class)
|
267
|
+
self[id_field] = self.class.generate_cool_id if self[id_field].blank?
|
152
268
|
end
|
153
269
|
|
270
|
+
# Ensures that CoolId is configured for the model.
|
271
|
+
# @raise [NotConfiguredError] If CoolId is not configured and setup is required.
|
272
|
+
# @return [void]
|
154
273
|
def ensure_cool_id_configured
|
155
274
|
if self.class.cool_id_setup_required && self.class.cool_id_config.nil?
|
156
275
|
suggested_prefix = self.class.name.downcase[0..2]
|
@@ -160,10 +279,16 @@ module CoolId
|
|
160
279
|
end
|
161
280
|
end
|
162
281
|
|
282
|
+
# Locates a record by its CoolId.
|
283
|
+
# @param id [String] The CoolId to look up.
|
284
|
+
# @return [ActiveRecord::Base, nil] The found record, or nil if not found.
|
163
285
|
def self.locate(id)
|
164
286
|
registry.locate(id)
|
165
287
|
end
|
166
288
|
|
289
|
+
# Parses a CoolId into its components.
|
290
|
+
# @param id [String] The CoolId to parse.
|
291
|
+
# @return [Id, nil] The parsed Id object, or nil if parsing fails.
|
167
292
|
def self.parse(id)
|
168
293
|
registry.parse(id)
|
169
294
|
end
|
metadata
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cool_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Schilling
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,19 +39,75 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '6.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '13.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '13.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: standard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.9.28
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.9.28
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webrick
|
43
99
|
requirement: !ruby/object:Gem::Requirement
|
44
100
|
requirements:
|
45
101
|
- - ">="
|
46
102
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
type: :
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
49
105
|
prerelease: false
|
50
106
|
version_requirements: !ruby/object:Gem::Requirement
|
51
107
|
requirements:
|
52
108
|
- - ">="
|
53
109
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
110
|
+
version: '0'
|
55
111
|
- !ruby/object:Gem::Dependency
|
56
112
|
name: sqlite3
|
57
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,30 +122,27 @@ dependencies:
|
|
66
122
|
- - "~>"
|
67
123
|
- !ruby/object:Gem::Version
|
68
124
|
version: '1.4'
|
69
|
-
description: generates primary keys using prefixed nanoids for ActiveRecord
|
125
|
+
description: CoolId generates primary keys using prefixed nanoids for ActiveRecord
|
126
|
+
models, providing unique and readable identifiers.
|
70
127
|
email:
|
71
128
|
- git@schpet.com
|
72
129
|
executables: []
|
73
130
|
extensions: []
|
74
131
|
extra_rdoc_files: []
|
75
132
|
files:
|
76
|
-
- ".
|
77
|
-
- ".rspec"
|
78
|
-
- ".standard.yml"
|
133
|
+
- ".yardopts"
|
79
134
|
- CHANGELOG.md
|
80
135
|
- LICENSE
|
81
136
|
- README.md
|
82
|
-
- Rakefile
|
83
137
|
- lib/cool_id.rb
|
84
138
|
- lib/cool_id/version.rb
|
85
|
-
- sig/cool_id.rbs
|
86
139
|
homepage: https://github.com/schpet/cool_id
|
87
140
|
licenses:
|
88
141
|
- ISC
|
89
142
|
metadata:
|
90
143
|
homepage_uri: https://github.com/schpet/cool_id
|
91
144
|
source_code_uri: https://github.com/schpet/cool_id
|
92
|
-
changelog_uri: https://github.com/schpet/cool_id/
|
145
|
+
changelog_uri: https://github.com/schpet/cool_id/blob/main/CHANGELOG.md
|
93
146
|
post_install_message:
|
94
147
|
rdoc_options: []
|
95
148
|
require_paths:
|
@@ -98,15 +151,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
151
|
requirements:
|
99
152
|
- - ">="
|
100
153
|
- !ruby/object:Gem::Version
|
101
|
-
version: 3.
|
154
|
+
version: 3.1.0
|
102
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
156
|
requirements:
|
104
157
|
- - ">="
|
105
158
|
- !ruby/object:Gem::Version
|
106
159
|
version: '0'
|
107
160
|
requirements: []
|
108
|
-
rubygems_version: 3.5.
|
161
|
+
rubygems_version: 3.5.22
|
109
162
|
signing_key:
|
110
163
|
specification_version: 4
|
111
|
-
summary:
|
164
|
+
summary: Generates cool ids for ActiveRecord models
|
112
165
|
test_files: []
|
data/.aider.conf.yml
DELETED
data/.rspec
DELETED
data/.standard.yml
DELETED
data/Rakefile
DELETED
data/sig/cool_id.rbs
DELETED