web-utils 0.1.3 → 0.1.4
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/web_utils.rb +3 -5
- data/test/test_web_utils.rb +14 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c51f28f3490e185eefa169866d88af1b0cf15ce3a61f7a8fbdb9acf955dd160a
|
4
|
+
data.tar.gz: b047825464803b6a4c49f79dae32d8159b38f5e3edef97c9712f647bf258a920
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3cecb91f83b58fe4c03fceb8941afe56c4dd43d0996adb4a0a92d90cbd413309c4af23c047ba199647a00f14640993becb5765903d07378e78922797d6c5b44
|
7
|
+
data.tar.gz: 9227bf1102a6747c5375386ceba11982b929025b83078850e15817d3876d4f1f5817dff32c401ddf2320de40febcf6abe3c89e843912cbf9452955c5b1f1420c
|
data/lib/web_utils.rb
CHANGED
@@ -5,7 +5,7 @@ require 'uri'
|
|
5
5
|
|
6
6
|
module WebUtils
|
7
7
|
|
8
|
-
VERSION = '0.1.
|
8
|
+
VERSION = '0.1.4'
|
9
9
|
|
10
10
|
# Most methods are supposed to be as simple as possible
|
11
11
|
# and just cover most cases.
|
@@ -108,10 +108,8 @@ module WebUtils
|
|
108
108
|
end
|
109
109
|
module_function :ensure_key
|
110
110
|
|
111
|
-
ACCENTS =
|
112
|
-
|
113
|
-
WITHOUT_ACCENTS =
|
114
|
-
"AAAAAAaaaaaaAaAaAaCcCcCcCcCcDdDdDdEEEEeeeeEeEeEeEeEeGgGgGgGgHhHhIIIIiiiiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnNnnNnOOOOOOooooooOoOoOoRrRrRrSsSsSsSssT"
|
111
|
+
ACCENTS = "ÀÁÂÃÄÅàáâãäåĀāĂ㥹ÇçĆćĈĉĊċČčÐðĎďĐđÈÉÊËèéêëĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħÌÍÎÏìíîïĨĩĪīĬĭĮįİıĴĵĶķĸĹĺĻļĽľĿŀŁłÑñŃńŅņŇňʼnŊŋÒÓÔÕÖØòóôõöøŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšſŢţŤťŦŧÙÚÛÜùúûüŨũŪūŬŭŮůŰűŲųŴŵÝýÿŶŷŸŹźŻżŽž"
|
112
|
+
WITHOUT_ACCENTS = "AAAAAAaaaaaaAaAaAaCcCcCcCcCcDdDdDdEEEEeeeeEeEeEeEeEeGgGgGgGgHhHhIIIIiiiiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnNnnNnOOOOOOooooooOoOoOoRrRrRrSsSsSsSssTtTtTtUUUUuuuuUuUuUuUuUuUuWwYyyYyYZzZzZz"
|
115
113
|
def slugify s, force_lower=true
|
116
114
|
s = s.to_s
|
117
115
|
.tr(ACCENTS, WITHOUT_ACCENTS)
|
data/test/test_web_utils.rb
CHANGED
@@ -324,7 +324,12 @@ describe WebUtils do
|
|
324
324
|
['42hello', '42hello'],
|
325
325
|
['5.0hello', '5.0hello']
|
326
326
|
].each do |(arg,result)|
|
327
|
-
|
327
|
+
# This `if` statement is now needed to avoid a depracation warning.
|
328
|
+
if result.nil?
|
329
|
+
assert_nil utils.automatic_typecast(arg)
|
330
|
+
else
|
331
|
+
assert_equal result, utils.automatic_typecast(arg)
|
332
|
+
end
|
328
333
|
end
|
329
334
|
end
|
330
335
|
it 'Can change what is typecasted' do
|
@@ -345,10 +350,16 @@ describe WebUtils do
|
|
345
350
|
|
346
351
|
describe '#generate_random_id' do
|
347
352
|
it 'Has the correct format' do
|
348
|
-
|
353
|
+
out, err = capture_io do
|
354
|
+
assert_match /[a-zA-Z0-9]{16}/, utils.generate_random_id
|
355
|
+
end
|
356
|
+
assert_match "WebUtils::generate_random_id is deprecated", err
|
349
357
|
end
|
350
358
|
it 'Can have a specific length' do
|
351
|
-
|
359
|
+
out, err = capture_io do
|
360
|
+
assert_match /[a-zA-Z0-9]{32}/, utils.generate_random_id(32)
|
361
|
+
end
|
362
|
+
assert_match "WebUtils::generate_random_id is deprecated", err
|
352
363
|
end
|
353
364
|
end
|
354
365
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mickael Riga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
|
-
rubygems_version: 3.0.
|
88
|
+
rubygems_version: 3.0.3
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: Web Utils
|