stduritemplate 0.0.49 → 0.0.52
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stduritemplate.rb +22 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf0bbba2eb1fd6a23888deb9e842be7e8b310c47153fe276d055ab7e42ec1864
|
4
|
+
data.tar.gz: e6b8ee16919e646d6c8aa788533cd179eae6dc9c52a64ad3c046e67efc709ce7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1119ccf5ae3ca0b425026896fd6db74bae3df0842cf8cd3b7f83572e3f20e604ca74e73d916d0108359795d14ba15416a8970b2e1739c5f2447c8e3e461d8a3
|
7
|
+
data.tar.gz: 10bd3997b3b7e42a64fbf8e8b932f418c207df9ee3cc81251451a40a75752ca3b344e8e6b3a16aae8565a6736700837c0c52b6f99bce638d7850592292299e73
|
data/lib/stduritemplate.rb
CHANGED
@@ -188,6 +188,20 @@ module StdUriTemplate
|
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
191
|
+
def self.is_surrogate(cp)
|
192
|
+
cp.bytes.length > 1
|
193
|
+
end
|
194
|
+
|
195
|
+
def self.is_iprivate(cp)
|
196
|
+
(0xE000..0xF8FF).include?(cp.ord)
|
197
|
+
end
|
198
|
+
|
199
|
+
def self.is_ucschar(cp)
|
200
|
+
(0xA0..0xD7FF).include?(cp.ord) ||
|
201
|
+
(0xF900..0xFDCF).include?(cp.ord) ||
|
202
|
+
(0xFDF0..0xFFEF).include?(cp.ord)
|
203
|
+
end
|
204
|
+
|
191
205
|
def self.add_expanded_value(prefix, value, result, max_char, replace_reserved)
|
192
206
|
string_value = convert_native_types(value)
|
193
207
|
max = (max_char != -1) ? [max_char, string_value.length].min : string_value.length
|
@@ -204,8 +218,13 @@ module StdUriTemplate
|
|
204
218
|
reserved_buffer = ''
|
205
219
|
end
|
206
220
|
|
221
|
+
to_append = character
|
222
|
+
if is_surrogate(character) || replace_reserved || is_ucschar(character) || is_iprivate(character)
|
223
|
+
to_append = URI.encode_www_form_component(character)
|
224
|
+
end
|
225
|
+
|
207
226
|
if reserved_buffer
|
208
|
-
reserved_buffer <<
|
227
|
+
reserved_buffer << to_append
|
209
228
|
|
210
229
|
if reserved_buffer.length == 3
|
211
230
|
is_encoded = false
|
@@ -230,22 +249,14 @@ module StdUriTemplate
|
|
230
249
|
elsif character == '%'
|
231
250
|
result << "%25"
|
232
251
|
else
|
233
|
-
|
234
|
-
result << URI.encode_www_form_component(character)
|
235
|
-
else
|
236
|
-
result << character
|
237
|
-
end
|
252
|
+
result << to_append
|
238
253
|
end
|
239
254
|
end
|
240
255
|
end
|
241
256
|
|
242
257
|
if reserved_buffer
|
243
258
|
result << "%25"
|
244
|
-
|
245
|
-
result << URI.encode_www_form_component(reserved_buffer[1..-1])
|
246
|
-
else
|
247
|
-
result << reserved_buffer[1..-1]
|
248
|
-
end
|
259
|
+
result << reserved_buffer[1..-1]
|
249
260
|
end
|
250
261
|
end
|
251
262
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stduritemplate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.52
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrea Peruffo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: std-uritemplate implementation for Ruby
|
14
14
|
email: andrea.peruffo1982@gmail.com
|