phony 2.5.2 → 2.5.3

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjgyNzBkYTU1NDg4NDE3OWNjZjU3YzVmODc3MWY2MjBlNTRkY2E4NQ==
4
+ ZGQ1ZTY1ZTQ1NTMxY2E1ZGU0Mzk2Y2IxODQ0YWRjYTUxM2VkNDI2OA==
5
5
  data.tar.gz: !binary |-
6
- M2U4YTMxNWM1NjA4ZTI4MjM0MWMxMzRlYTg4MDA0YmRmMzEyOGVkNg==
6
+ MjQ5ODI0YzFlYjMxOTcxNjE2ODY4OWJkMmQzNjU3YTE4ZTdhYWJmYw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NWQ4YTI5Y2I0NDFhZDgyNjE5NDIyNjc0MWUyZjQyNTAwMzRlYWM4NmNkYmNi
10
- MGE0ZThmOTk2NWM3YzRhZmEzNmZjYWFhZTZjY2ZjMzNlNzliOTk1MGE5MGNl
11
- MjI0NjdiNDJiNjRjYzcxMjRhNGJmODUwNWIzMGYxZmQ1Yjg0ZDQ=
9
+ MDQ1YWM2ZWQ4NWIyOWNmMDg5ZDIxMmEwNDQ2OTRhNzY5MDM3YjM3ODBhNGQw
10
+ MjQyZjIwOGQ2ZmY4MDBjNmY0OGI0Y2VhOWRiMTI3ZDhhZDAwMDJjNDA3ZjE1
11
+ YWVhNGVkNzFjY2JhY2RkNzA2ZGNlZjg5YmQxYmIzZGNmZDI3ODI=
12
12
  data.tar.gz: !binary |-
13
- OGUzMmU1N2Q5NzAyMjQ0NmQyOTE3NzQxYjNjMjY3ZDNhYjc4ZTNiZmQ0MmI0
14
- MGQ2MWZmMzc4ODVmMzFhM2M1M2E1NWRmOTFmM2U3YTE2ZjQ2MGI1MjUwYWUw
15
- MWY4ZWQ4NDQ4ZDIzM2UzMWUzNDlhMzQ1YzVlMmJmNjcyNjcwZTY=
13
+ YTk2N2Y1N2JlZjI2M2I1ZWY2YjY1MWJmNDk2MzFjOTljZmVlYTJkNmRmYmFj
14
+ Yzk3MWQ4OTRlNTQyNDQ4ZDlhNjFlYjMzYjYwZDVkMzMwODRhMGVjNDQ1OGFi
15
+ NTg1YmMxYTcwMzFiYTkzOWQ1NDQ3ZjhmNjQxYzAwNWE5NTZiMmI=
@@ -77,7 +77,7 @@ six_or_seven_digit_mobile_prefixes = [
77
77
  ]
78
78
 
79
79
  Phony.define do
80
- country '855', trunk('0') | one_of(six_digit_mobile_prefixes) >> matched_split(/^[1-9]/ => [3, 3]) |
80
+ country '855', trunk('0', :normalize => true) | one_of(six_digit_mobile_prefixes) >> matched_split(/^[1-9]/ => [3, 3]) |
81
81
  one_of(seven_digit_mobile_prefixes) >> matched_split(/^[2-9]/ => [3, 4]) |
82
82
  one_of(six_or_seven_digit_mobile_prefixes) >> matched_split(
83
83
  /^[2-9]\d{5}$/ => [3, 3], /^[1-9]\d{6}$/ => [3, 4]
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe 'Phony#normalize' do
4
4
 
5
5
  describe 'cases' do
6
-
6
+
7
7
  describe 'regressions' do
8
8
  it '#151' do
9
9
  # Normalizes, but this is a non-real case.
@@ -12,7 +12,7 @@ describe 'Phony#normalize' do
12
12
  Phony.normalize('111-111-1111', cc: '1').should == '1111111111'
13
13
  end
14
14
  end
15
-
15
+
16
16
  it 'handles the US (with cc) correctly' do
17
17
  Phony.normalize('+1 724 999 9999').should == '17249999999'
18
18
  end
@@ -31,7 +31,9 @@ describe 'Phony#normalize' do
31
31
  it 'handles a German number with extra 0' do
32
32
  Phony.normalize('+49 0 209 22 33 44 55').should == '4920922334455'
33
33
  end
34
-
34
+ it 'handles Cambodian numbers with an extra 0' do
35
+ Phony.normalize('+855012239134').should == "85512239134"
36
+ end
35
37
  it 'should normalize a too short number' do
36
38
  Phony.normalize('+972').should eql '972'
37
39
  end
@@ -65,7 +67,7 @@ describe 'Phony#normalize' do
65
67
  it 'should not normalize a number with a correct zero inside' do
66
68
  Phony.normalize('+390909709511').should eql '390909709511'
67
69
  end
68
-
70
+
69
71
  it "handles completely crazy 'numbers'" do
70
72
  Phony.normalize('Hello, I am Cora, the 41th parrot, and 44 is my 364 times 35 funky number. 32.').should eql '41443643532'
71
73
  end
@@ -84,7 +86,7 @@ describe 'Phony#normalize' do
84
86
  Phony.normalize('375 152450911').should eql '375152450911'
85
87
  end
86
88
  end
87
-
89
+
88
90
  describe 'exceptions' do
89
91
  it 'raises on nil' do
90
92
  expect {
@@ -102,7 +104,7 @@ describe 'Phony#normalize' do
102
104
  end.to raise_error(Phony::NormalizationError, 'Phony could not normalize the given number. Is it a phone number?')
103
105
  end
104
106
  end
105
-
107
+
106
108
  describe 'country-based' do
107
109
  it 'normalizes the US correctly' do
108
110
  Phony["1"].normalize("555 1234567890").should eql '5551234567890'
@@ -115,5 +117,5 @@ describe 'Phony#normalize' do
115
117
  end
116
118
  end
117
119
  end
118
-
119
- end
120
+
121
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.2
4
+ version: 2.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Hanke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-04 00:00:00.000000000 Z
11
+ date: 2014-10-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ! 'Fast international phone number (E164 standard) normalizing, splitting
14
14
  and formatting. Lots of formatting options: International (+.., 00..), national