phonelib 0.10.3 → 0.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9fe27c3c85d76103dc9fe5fe1a3877f31fd06cf6b3327b25d4f93aea3238ca63
4
- data.tar.gz: 15b2fb31d0e9997d0ef6fef3502a15499d8bd151a05f8ffd6ef08c23729db121
3
+ metadata.gz: fb1fdf7dccd5aea928ae10a90c388d762b030e8c4def7a65d877923eeb3a4ca8
4
+ data.tar.gz: b59f64fb4a31d30dd168673fd1b7449821e49fdb561f41aa81a2441b7cd56cc1
5
5
  SHA512:
6
- metadata.gz: 585a0298a4ec578788d3ee34d4c8c567290b9734f051a7bb73e85515b33b54c37792757d91a1c07fead6c9473bc6c5b9913c3313dc45fee03ea5e27e8152adda
7
- data.tar.gz: 715cf0441e86fa0d3f8522023ace36fb3fe367e1c84c373d88130d87a8e51d8c8ed40bc17830d875d9c0f3b79d42ca81f3032106dce3964fc88ac3397c369d97
6
+ metadata.gz: d66563c8732ed401d1eefc8e2a2bf4339b047e1e5c840f5811cf590901461c403172abbb2fbb820adfaf2fc12ace71f5579d6089f104f9c85b8bc420faf4f2a0
7
+ data.tar.gz: 0ed58b39980e34e6bf3696c0513f44c284576bafec199cd56baa242589e1b1adce29cadd3621061c33e9bfe1feec2851a839ec665a813d7010660bd5a51e733b
data/README.md CHANGED
@@ -13,7 +13,7 @@ But it still doesn't include all Google's library functionality.
13
13
 
14
14
  ## Incorrect parsing or validation
15
15
 
16
- In case your phone number is incorrectly parsed, you can check original libphonenumber for result [here](https://rawgit.com/googlei18n/libphonenumber/master/javascript/i18n/phonenumbers/demo-compiled.html) and in case of same parse result [open an issue for them](https://issuetracker.google.com/issues/new?component=192347&template=829703). This gem's data is based on it.
16
+ In case your phone number is incorrectly parsed, you can check original libphonenumber for result [here](https://htmlpreview.github.io/?https://github.com/google/libphonenumber/blob/master/javascript/i18n/phonenumbers/demo-compiled.html) and in case of same parse result [open an issue for them](http://issuetracker.google.com/issues/new?component=192347). This gem's data is based on it.
17
17
  If you can't wait for libphonenumber to resolve the issue, try to use ```Phonelib.add_additional_regex``` and ```Phonelib.additional_regexes``` methods.
18
18
 
19
19
  ## Information
Binary file
data/data/phone_data.dat CHANGED
Binary file
@@ -69,9 +69,15 @@ module Phonelib
69
69
  end
70
70
 
71
71
  # replacing national prefix to simplified format
72
- def with_replaced_national_prefix(phone, data)
73
- return phone unless data[Core::NATIONAL_PREFIX_TRANSFORM_RULE]
74
- phone = phone.gsub(/^#{data[Core::COUNTRY_CODE]}/, '') if phone.start_with?(data[Core::COUNTRY_CODE]) && !data[Core::DOUBLE_COUNTRY_PREFIX_FLAG]
72
+ def with_replaced_national_prefix(passed_phone, data)
73
+ return passed_phone unless data[Core::NATIONAL_PREFIX_TRANSFORM_RULE]
74
+ phone = if passed_phone.start_with?(data[Core::COUNTRY_CODE]) && !data[Core::DOUBLE_COUNTRY_PREFIX_FLAG]
75
+ passed_phone.gsub(/^#{data[Core::COUNTRY_CODE]}/, '')
76
+ else
77
+ passed_phone
78
+ end
79
+ return passed_phone unless phone.match? cr("^#{type_regex(data[Core::TYPES][Core::GENERAL], Core::POSSIBLE_PATTERN)}$")
80
+
75
81
  pattern = cr("^(?:#{data[Core::NATIONAL_PREFIX_FOR_PARSING]})")
76
82
  match = phone.match pattern
77
83
  if match && match.captures.compact.size > 0
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Phonelib
4
4
  # @private
5
- VERSION = '0.10.3'
5
+ VERSION = '0.10.4'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phonelib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vadim Senderovich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-16 00:00:00.000000000 Z
11
+ date: 2025-02-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  Google libphonenumber library was taken as a basis for
@@ -40,7 +40,7 @@ homepage: https://github.com/daddyz/phonelib
40
40
  licenses:
41
41
  - MIT
42
42
  metadata:
43
- changelog_uri: https://github.com/daddyz/phonelib/releases/tag/v0.10.3
43
+ changelog_uri: https://github.com/daddyz/phonelib/releases/tag/v0.10.4
44
44
  post_install_message:
45
45
  rdoc_options:
46
46
  - " --no-private - CHANGELOG.md --readme README.md"