phony 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,12 @@
5
5
 
6
6
  # TODO 4-digit services, like "unreasonable infringement of livelihood report" number :)
7
7
  #
8
- service = %w{ 30 50 60 70 80 100 101 105 106 107 108 109 111 112 113 114 115 116 117 118 119 120 121 122 123 125 127 128 129 131 132 134 141 182 188 }
9
- mobile = ('10'..'19').to_a
8
+
9
+ special = %w{ 100 101 105 106 107 108 109 111 112 113 114 115 116 117 118 119 120 121 122 123 125 127 128 129 131 132 134 141 182 188 }
10
+ # mobile = ('10'..'19').to_a # Note: Mobile not used as it is (for now) handled by the one_of rule.
10
11
 
11
12
  Phony.define do
12
- country '82', one_of(*service) >> split(3,3) |
13
- one_of(*mobile) >> split(4,4) |
14
- one_of('2', :max_length => 2) >> split(4,4) # Seoul
13
+ country '82', match(/^(#{special.join("|")})$/) >> split(3,3) | # Special actually don't need to be split – but better err.
14
+ # one_of(*mobile) >> split(4,4) |
15
+ one_of('2', :max_length => 2) >> split(4,4) # Seoul, also includes "services".
15
16
  end
@@ -162,6 +162,7 @@ describe 'country descriptions' do
162
162
  Phony.split('82212345678').should == ['82', '2', '1234', '5678'] # Seoul
163
163
  Phony.split('825112345678').should == ['82', '51', '1234', '5678'] # Busan
164
164
  Phony.split('821027975588').should == ['82', '10', '2797', '5588'] # mobile
165
+ Phony.split('821087971234').should == ['82', '10', '8797', '1234'] # mobile
165
166
  end
166
167
  it 'handles thai numbers' do
167
168
  Phony.split('6621231234').should == ['66', '2', '123', '1234'] # Bangkok
metadata CHANGED
@@ -1,26 +1,28 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: phony
3
- version: !ruby/object:Gem::Version
4
- version: 1.5.0
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 1.5.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Florian Hanke
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-12 00:00:00.000000000 +02:00
12
+
13
+ date: 2011-10-22 00:00:00 +11:00
13
14
  default_executable:
14
15
  dependencies: []
15
- description: ! 'Fast international phone number (E164 standard) normalizing, splitting
16
- and formatting. Lots of formatting options: International (+.., 00..), national
17
- (0..), and local).'
16
+
17
+ description: "Fast international phone number (E164 standard) normalizing, splitting and formatting. Lots of formatting options: International (+.., 00..), national (0..), and local)."
18
18
  email: florian.hanke+phony@gmail.com
19
19
  executables: []
20
+
20
21
  extensions: []
21
- extra_rdoc_files:
22
+
23
+ extra_rdoc_files:
22
24
  - README.textile
23
- files:
25
+ files:
24
26
  - lib/phony/countries/austria.rb
25
27
  - lib/phony/countries/china.rb
26
28
  - lib/phony/countries/germany.rb
@@ -62,30 +64,32 @@ files:
62
64
  has_rdoc: true
63
65
  homepage: http://github.com/floere/phony
64
66
  licenses: []
67
+
65
68
  post_install_message:
66
69
  rdoc_options: []
67
- require_paths:
70
+
71
+ require_paths:
68
72
  - lib
69
- required_ruby_version: !ruby/object:Gem::Requirement
73
+ required_ruby_version: !ruby/object:Gem::Requirement
70
74
  none: false
71
- requirements:
72
- - - ! '>='
73
- - !ruby/object:Gem::Version
74
- version: '0'
75
- required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
80
  none: false
77
- requirements:
78
- - - ! '>='
79
- - !ruby/object:Gem::Version
80
- version: '0'
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: "0"
81
85
  requirements: []
86
+
82
87
  rubyforge_project:
83
- rubygems_version: 1.6.2
88
+ rubygems_version: 1.5.0
84
89
  signing_key:
85
90
  specification_version: 3
86
- summary: Fast international phone number (E164 standard) normalizing, splitting and
87
- formatting.
88
- test_files:
91
+ summary: Fast international phone number (E164 standard) normalizing, splitting and formatting.
92
+ test_files:
89
93
  - spec/lib/phony/countries_spec.rb
90
94
  - spec/lib/phony/country_codes_spec.rb
91
95
  - spec/lib/phony/country_spec.rb