phonelib 0.8.9 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3414f233adef031f8260b96cb0d293b8aaee972043544d01084a9f840a60824
4
- data.tar.gz: 7d0b91d44164cc5d124a0303334b90959ec4e6bfa1768b5772fa98373b740f74
3
+ metadata.gz: cfc1c4a9625861e072096320aec6b4867d509d47b170fcd0a92c0ffde521f7b5
4
+ data.tar.gz: f0d3db76ed4614f8667796d79b4166d2827801997b04986429d7b80418337420
5
5
  SHA512:
6
- metadata.gz: fac30ff6c40df1d8f5f85d09bf48e717d938beb12ec257d5048a7046c07efdfd0eac6321909126eb9ce18da8bd0c3e48bb71fd5d43e15f66906f59e2dda2cd89
7
- data.tar.gz: dc761323a8babda14e47b4bedaec35a89d822ee617c72330490426d90a2545553eaf9bcc2e238d72d7b239ae979f21bc9c167727a42e5766e377d8b0f95dd663
6
+ metadata.gz: 03fd33d4683e7845bb94c5293ab0d9e28654cf4e9024a60221e62017d60a396c71167382ce40eef5ff60fcc1c2578845a6bdf996050f275e198dc04c280a54b3
7
+ data.tar.gz: 9fe16f0ecab0ce8f583a61c7516052b59394d11f4555b267c1602cd6c5113fda3b109a8e0e4d6c3624ce2e01c39b3e32e89b52b2f63ffb0e019e7359b6cddb5f
Binary file
data/data/phone_data.dat CHANGED
Binary file
@@ -70,10 +70,11 @@ module Phonelib
70
70
  # replacing national prefix to simplified format
71
71
  def with_replaced_national_prefix(phone, data)
72
72
  return phone unless data[Core::NATIONAL_PREFIX_TRANSFORM_RULE]
73
+ phone = phone.gsub(/^#{data[Core::COUNTRY_CODE]}/, '') if phone.start_with?(data[Core::COUNTRY_CODE])
73
74
  pattern = cr("^(?:#{data[Core::NATIONAL_PREFIX_FOR_PARSING]})")
74
75
  match = phone.match pattern
75
76
  if match && match.captures.compact.size > 0
76
- phone.gsub(pattern, data[Core::NATIONAL_PREFIX_TRANSFORM_RULE])
77
+ data[Core::COUNTRY_CODE] + phone.gsub(pattern, data[Core::NATIONAL_PREFIX_TRANSFORM_RULE])
77
78
  else
78
79
  phone
79
80
  end
@@ -1,4 +1,4 @@
1
1
  module Phonelib
2
2
  # @private
3
- VERSION = '0.8.9'
3
+ VERSION = '0.9.0'
4
4
  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.8.9
4
+ version: 0.9.0
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-06-02 00:00:00.000000000 Z
11
+ date: 2024-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake