globalid 0.6.0 → 1.0.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/lib/global_id/uri/gid.rb +4 -7
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5a7361595eea95f395b66f4a79123ad35e61b7008d256646bea775291fa9f41
|
4
|
+
data.tar.gz: a9ece75bb440f6b49b8ad623b976bc05f4f3da2151104d045d1b7305c4a8d9b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8290a4a79953bb92053c2f52ae847c557e7f5d4f0528124c7f1217ee4a34b5c7d42290a2584d729e0c5011c05cd1df4c9c073be49bde7d4fa13597f44a52513f
|
7
|
+
data.tar.gz: 2d9e7c573f7223406733b8be7ce1d6d764cca584bcfbb0a3f2ffb8d6f71f82970ceacf827e9c8a251975c0681b5d7d8293c1e158927dbf38f362e1337fd027ce
|
data/lib/global_id/uri/gid.rb
CHANGED
@@ -123,9 +123,6 @@ module URI
|
|
123
123
|
private
|
124
124
|
COMPONENT = [ :scheme, :app, :model_name, :model_id, :params ].freeze
|
125
125
|
|
126
|
-
# Extracts model_name and model_id from the URI path.
|
127
|
-
PATH_REGEXP = %r(\A/([^/]+)/?([^/]+)?\z)
|
128
|
-
|
129
126
|
def check_host(host)
|
130
127
|
validate_component(host)
|
131
128
|
super
|
@@ -145,11 +142,11 @@ module URI
|
|
145
142
|
end
|
146
143
|
|
147
144
|
def set_model_components(path, validate = false)
|
148
|
-
_, model_name, model_id = path.
|
149
|
-
model_id = CGI.unescape(model_id) if model_id
|
150
|
-
|
145
|
+
_, model_name, model_id = path.split('/', 3)
|
151
146
|
validate_component(model_name) && validate_model_id(model_id, model_name) if validate
|
152
147
|
|
148
|
+
model_id = CGI.unescape(model_id) if model_id
|
149
|
+
|
153
150
|
@model_name = model_name
|
154
151
|
@model_id = model_id
|
155
152
|
end
|
@@ -162,7 +159,7 @@ module URI
|
|
162
159
|
end
|
163
160
|
|
164
161
|
def validate_model_id(model_id, model_name)
|
165
|
-
return model_id unless model_id.blank?
|
162
|
+
return model_id unless model_id.blank? || model_id.include?('/')
|
166
163
|
|
167
164
|
raise MissingModelIdError, "Unable to create a Global ID for " \
|
168
165
|
"#{model_name} without a model id."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: globalid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -60,7 +60,7 @@ homepage: http://www.rubyonrails.org
|
|
60
60
|
licenses:
|
61
61
|
- MIT
|
62
62
|
metadata: {}
|
63
|
-
post_install_message:
|
63
|
+
post_install_message:
|
64
64
|
rdoc_options: []
|
65
65
|
require_paths:
|
66
66
|
- lib
|
@@ -75,8 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
rubygems_version: 3.
|
79
|
-
signing_key:
|
78
|
+
rubygems_version: 3.5.0.dev
|
79
|
+
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: 'Refer to any model with a URI: gid://app/class/id'
|
82
82
|
test_files: []
|