phony 2.0.0.beta12 → 2.0.0.beta13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTgxNzcwMjc1YzQ3NWMxNjI2OTliMjc5ODNmZWM4ZGZmZWUxNDc4Nw==
4
+ ZGM3YzY5ZGU1OWYxZjQ1ZTRmNWEzMTRmNTFkZDM2YzliNTQzMjU3Zg==
5
5
  data.tar.gz: !binary |-
6
- NDc2YTFiODczMGRkYWMzOTlhMGQ2ZWMyNmNmYTU0YTBlOTVhZWE4MA==
6
+ OGUwYmEzYzdlOWM1NmFkYjczNTJkNWQxN2JhZThkZGE3YzNiYjI0Yw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MmIyYTJiMzc5NTdhMmI3NjY0NmE4ZmVmOWFjNDliYjMxNDc4MmM5M2Q0ODJh
10
- MTExYmZhMmE4Nzc3YTNmMzQ3OTRjOThiOGVhNTg3N2EwYmE1NTg2YjM0Yjg0
11
- ZGFjYzA4ZThiZTFkYmE2MDYyNmEyMDJkOTQ1MzAxOTRhMTQ1MTg=
9
+ NWE5ZDEwNmNiNjI0YzIzZjM3NzYyNDY4YzNhMDc5NDg5YzhjYmI1ZGJlM2Y4
10
+ NWVkYzg4YTZlY2ZjOWJkMzkzYzMyMzE1NmM2Njk0M2RmNmEwMjFmNDJiMzFh
11
+ NTRjNmFkYjZmZjRhNzc2ZGQzMTYwYjA2ZmI0NDg0MjI3ZGQ4MDg=
12
12
  data.tar.gz: !binary |-
13
- ZTE0MTMzZTZkMDcwY2Y5MDI5MjM5MzhjMWQxMjRlMzcyMzZmZDNkZjBjNGU0
14
- ZjNlYTcyYzgzOWYyMDVhZjhjMDFlZjYxYTJkZWIzOWE1OWVlNWY2MzA4ZDg4
15
- YjdiMDJjYzZkN2NmNjgwODRhMzUzYTFmYjZkYTVjNTIxN2E2YTc=
13
+ OGIwZmQ2YWJlMTY0NjNmMTMyNWUzYTM0OGZlMmUyOWVlMjg3MGVhMmRlYjUy
14
+ Y2Q1YWM2OTI4NDQ2MTNlMzg4NDExNDgzMzJkNzkzYzNmMDUwZjJhNDdlY2Rm
15
+ YTdmODY3MmM0ZDQxZjA3NjZkN2Q0ODMxYzNmNTE2NzBiNGU5NTQ=
data/README.textile CHANGED
@@ -1,4 +1,5 @@
1
1
  "!{float:right}https://secure.travis-ci.org/floere/phony.png!":http://travis-ci.org/floere/phony
2
+ "!https://codeclimate.com/github/floere/phony.png!":https://codeclimate.com/github/floere/phony
2
3
 
3
4
  h1. Phony
4
5
 
@@ -110,7 +110,7 @@ Phony.define do
110
110
  #
111
111
  country '45',
112
112
  none >> split(2,2,2,2..2)
113
-
113
+
114
114
  # country '46' # Sweden, see special file.
115
115
 
116
116
  # Norway.
@@ -853,6 +853,7 @@ Phony.define do
853
853
  # Cambodia (Kingdom of)
854
854
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Cambodia
855
855
  country '855',
856
+ match(/^(1\d{1})/) >> split(3, 3) |
856
857
  fixed(2) >> matched_split(/^\d{6}$/ => [3,3], /^\d{7}$/ => [3,4])
857
858
 
858
859
  # Lao People's Democratic Republic http://www.wtng.info/wtng-856-la.html, https://www.numberingplans.com
@@ -325,10 +325,22 @@ describe 'validations' do
325
325
  it_is_correct_for 'Brunei Darussalam', :samples => '+673 5 523 876'
326
326
  it_is_correct_for 'Burkina Faso', :samples => '+226 1476 2312'
327
327
  it_is_correct_for 'Burundi', :samples => '+257 1234 5678'
328
- it_is_correct_for "Cambodia", :samples => [["+855 12 236 142",
329
- "+855 97 710 0872"],
330
- ["+855 234 601 183",
331
- "855 33 123 456"]]
328
+
329
+ it 'is correct for Cambodia' do
330
+ # 7 digit identifiers
331
+ Phony.plausible?("+855965787807").should be_true # Smart
332
+ Phony.plausible?("+855312067777").should be_true # Beeline
333
+ Phony.plausible?("+855383001801").should be_true # CooTel
334
+ Phony.plausible?("+855973001801").should be_true # Metfone
335
+ Phony.plausible?("+855883001801").should be_true # Metfone
336
+ Phony.plausible?("+85510234567").should be_true # Smart
337
+ Phony.plausible?("+85511234564").should be_true # Mobitel (former Mfone)
338
+ Phony.plausible?("+855 12 236 142").should be_true # Mobitel
339
+ Phony.plausible?("+855 234 601 183").should be_true # Long fixed line (Phnom Penh)
340
+ Phony.plausible?("855 33 123 456").should be_true # Regular fixed line (Kampot)
341
+ Phony.plausible?("+855102345678").should be_false # Too many digits for a 01 prefix
342
+ end
343
+
332
344
  it_is_correct_for 'Cameroon', :samples => '+237 7372 8186'
333
345
  it_is_correct_for 'Cape Verde', :samples => '+238 642 3843'
334
346
  it_is_correct_for 'Central African Republic', :samples => '+236 1234 5678'
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.0.0.beta12
4
+ version: 2.0.0.beta13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Hanke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-17 00:00:00.000000000 Z
11
+ date: 2013-11-26 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
@@ -126,3 +126,4 @@ test_files:
126
126
  - spec/lib/phony/validations_spec.rb
127
127
  - spec/lib/phony/vanity_spec.rb
128
128
  - spec/lib/phony_spec.rb
129
+ has_rdoc: false