worldwide 1.11.0 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/Gemfile.lock +1 -1
- data/lib/worldwide/address.rb +4 -2
- data/lib/worldwide/phone.rb +9 -4
- data/lib/worldwide/version.rb +1 -1
- 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: dbd0868290580c52211d482478466332dc15728b688a53b966eccbc82fc9a4b8
|
4
|
+
data.tar.gz: 24ef5f713338348f9708b6c70c17e758ea613d654f8d0c07f87f7e73c4c778fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75a75cfec661ab1c9a1690e8aa01b0b803d2e0cd33da6f6f26853360f7ee837134236db8a64c1f7ce0716c69f374664c5ee8c1f0a9090dab4027e6d2785d401c
|
7
|
+
data.tar.gz: 8529dc4dce8a96795c801b2c80d95c0e862d3fdf652433248f09be1ff6fe8bad0b3cd49a7162ee36059659d5ef6ceba9b79c84c3c2f756647b9d46df663a2dc7
|
data/CHANGELOG.md
CHANGED
@@ -26,9 +26,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
26
26
|
- Security in case of vulnerabilities.
|
27
27
|
|
28
28
|
## [Unreleased]
|
29
|
-
|
29
|
+
- Nil.
|
30
30
|
---
|
31
31
|
|
32
|
+
## [1.12.0] - 2024-10-11
|
33
|
+
- Update Address splitting methods to split on the first delimiter [#291](https://github.com/Shopify/worldwide/pull/291)
|
34
|
+
|
35
|
+
## [1.11.1] - 2024-10-02
|
36
|
+
- Configure regexp timeout in Worldwide#Phone [#290](https://github.com/Shopify/worldwide/pull/290)
|
37
|
+
|
32
38
|
## [1.11.0] - 2024-10-02
|
33
39
|
- Add address1_regex to regions [#281](https://github.com/Shopify/worldwide/pull/281)
|
34
40
|
- Add address1_regex for BE, CL, MX, ES, IL [#282](https://github.com/Shopify/worldwide/pull/282)
|
data/Gemfile.lock
CHANGED
data/lib/worldwide/address.rb
CHANGED
@@ -167,13 +167,15 @@ module Worldwide
|
|
167
167
|
|
168
168
|
def split_address1
|
169
169
|
additional_fields = region.combined_address_format.dig(script_from_string(address1), "address1") || []
|
170
|
-
|
170
|
+
number_of_fields = additional_fields.size
|
171
|
+
split_fields_arr = address1&.split(RESERVED_DELIMITER, number_of_fields) || []
|
171
172
|
split_fields(additional_fields, split_fields_arr)
|
172
173
|
end
|
173
174
|
|
174
175
|
def split_address2
|
175
176
|
additional_fields = region.combined_address_format.dig(script_from_string(address2), "address2") || []
|
176
|
-
|
177
|
+
number_of_fields = additional_fields.size
|
178
|
+
split_fields_arr = address2&.split(RESERVED_DELIMITER, number_of_fields) || []
|
177
179
|
split_fields(additional_fields, split_fields_arr)
|
178
180
|
end
|
179
181
|
|
data/lib/worldwide/phone.rb
CHANGED
@@ -137,14 +137,19 @@ module Worldwide
|
|
137
137
|
number = input.downcase
|
138
138
|
|
139
139
|
["ext", "x", ";"].each do |separator|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
140
|
+
next unless number.include?(separator)
|
141
|
+
|
142
|
+
m = number.match(Regexp.new(
|
143
|
+
"(?<base>[0-9a-z +-]*)\\s*#{separator}\\.?\\s*(?<ext>.*)",
|
144
|
+
timeout: 1,
|
145
|
+
))
|
146
|
+
return [m["base"], m["ext"]] unless m.nil?
|
144
147
|
end
|
145
148
|
|
146
149
|
# If we get this far, then we have not found an extension, and assume that the full input is just a public number
|
147
150
|
[input, nil]
|
151
|
+
rescue Regexp::TimeoutError
|
152
|
+
[input, nil]
|
148
153
|
end
|
149
154
|
|
150
155
|
# Convert exotic characters to ASCII
|
data/lib/worldwide/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worldwide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -8505,7 +8505,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
8505
8505
|
- !ruby/object:Gem::Version
|
8506
8506
|
version: '0'
|
8507
8507
|
requirements: []
|
8508
|
-
rubygems_version: 3.5.
|
8508
|
+
rubygems_version: 3.5.21
|
8509
8509
|
signing_key:
|
8510
8510
|
specification_version: 4
|
8511
8511
|
summary: Internationalization and localization APIs
|