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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/global_id/uri/gid.rb +4 -7
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cfa513116ef143c878f8b6eefc242f9df668572c0ed3f3b4f5f5f87736e143f
4
- data.tar.gz: 72e073ae2eec42a6038cda7bbf77bbeed3f72899eafe801bac1aca6c6bb24079
3
+ metadata.gz: e5a7361595eea95f395b66f4a79123ad35e61b7008d256646bea775291fa9f41
4
+ data.tar.gz: a9ece75bb440f6b49b8ad623b976bc05f4f3da2151104d045d1b7305c4a8d9b2
5
5
  SHA512:
6
- metadata.gz: f3527628dfa02f3099b1c4ac0f99260f9187d83702e2cca96fab261592466fba1caa82e3dc936a54660ac9c4c0a2da087ebdabfb0d21444928979dd5cc983a34
7
- data.tar.gz: 460c643ca0f4d0a51dc9e218da9a891f05904d75e9106692d38a46fa7cc9ad1ace229e5bce37703e2f4e62aa049246628d61de9be444a32cd2a3e6a1452d0ff3
6
+ metadata.gz: 8290a4a79953bb92053c2f52ae847c557e7f5d4f0528124c7f1217ee4a34b5c7d42290a2584d729e0c5011c05cd1df4c9c073be49bde7d4fa13597f44a52513f
7
+ data.tar.gz: 2d9e7c573f7223406733b8be7ce1d6d764cca584bcfbb0a3f2ffb8d6f71f82970ceacf827e9c8a251975c0681b5d7d8293c1e158927dbf38f362e1337fd027ce
@@ -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.match(PATH_REGEXP).to_a
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.6.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: 2021-11-24 00:00:00.000000000 Z
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.2.22
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: []