phony 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -73,7 +73,8 @@ Phony.define do
73
73
  country '58', fixed(3) >> split(7) # Venezuela (Bolivarian Republic of)
74
74
 
75
75
  # country '60', Phony::Countries::Malaysia
76
- country '61', fixed(1) >> split(4,4) # Australia
76
+ country '61', match(/^(4\d\d)\d+$/) >> split(3,3) | # Australia
77
+ fixed(1) >> split(4,4)
77
78
  country '62', fixed(2) >> split(3,2,2) # TODO Indonesia (Republic of)
78
79
  country '63', fixed(2) >> split(3,2,2) # TODO Philippines (Republic of the)
79
80
  country '64', fixed(1) >> split(3,4) # New Zealand
@@ -4,9 +4,10 @@
4
4
  #
5
5
  # # Germany. Too big, we use a separate file:
6
6
  # #
7
- # include Phony::DSL
8
- # country '49', match(...) >> split([...]) ||
9
- # one_of([...], :max_length => 5) >> split([...])
7
+ # Phony.define do
8
+ # country '49', match(...) >> split([...]) ||
9
+ # one_of([...], :max_length => 5) >> split([...])
10
+ # end
10
11
  #
11
12
  # # Denmark:
12
13
  # #
@@ -18,7 +19,9 @@
18
19
  # match(/^104|105|107|112/) >> split([3,3]) ||
19
20
  # one_of([1], :max_length => 2) >> split([3,4])
20
21
  # )
21
-
22
+ #
23
+ # Note: Perhaps the DSL should operate directly on country codes.
24
+ #
22
25
  module Phony
23
26
 
24
27
  # For country definitions.
@@ -18,6 +18,10 @@ describe 'country descriptions' do
18
18
  Phony.split('433161234567891').should == ['43', '316', '1234567891'] # Graz
19
19
  Phony.split('432164123456789').should == ['43', '2164', '123456789'] # Rohrau
20
20
  end
21
+ it "handles australian numbers" do
22
+ Phony.split('61512341234').should == ['61', '5', '1234', '1234'] # Landline
23
+ Phony.split('61423123123').should == ['61', '423', '123', '123'] # Mobile
24
+ end
21
25
  it 'handles belgian numbers' do
22
26
  Phony.split('3235551212').should == ['32', '3', '555', '1212'] # Antwerpen
23
27
  Phony.split('32505551212').should == ['32', '50', '555', '1212'] # Brugge
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: phony
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.3.2
5
+ version: 1.3.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Florian Hanke
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-07 00:00:00 +01:00
13
+ date: 2011-04-19 00:00:00 +10:00
14
14
  default_executable:
15
15
  dependencies: []
16
16