phony 2.5.4 → 2.6.0
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 +6 -14
- data/lib/phony/countries.rb +1 -1
- data/lib/phony/country_codes.rb +5 -5
- data/lib/phony/trunk_code.rb +1 -1
- data/spec/lib/phony/country_codes_spec.rb +1 -1
- data/spec/lib/phony_spec.rb +1 -1
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
NWY2NWYyNjlhMTFmOWZhZDM3YWZiNTM1NjVmNGU1ZWIxYTQ4NWJmOGEyYjZl
|
10
|
-
ZTg5NDYwNjg3NDBmODRhYjYzMjk0ZWVjZDFiOTU2MTYyNWIyMWFmNjg3YTcy
|
11
|
-
Mjk4ZmQ1NzIzZmY1MjJkYzI4ZGU2OWZhMmJkZjczYjU5YTAwYjM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MzRiZjM0ZDUxNTE3OThiMzQyM2VkMDJjMjUwNjE0ZDU5MzhhYTIwYTZmNjM5
|
14
|
-
NWY5MzA5NWUzMmYzYTNiODg3OTdjMTRjZTBhNTE3YmM3MDc5OTAxODQ2MDc5
|
15
|
-
ZTQzZGQ3MWU2MmE5MWYzZDcxNGVlYWM3MGEzM2IyNDU4ZDgxYTE=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0c1360362a2bca58b46e145890a6dac68b27ebc6
|
4
|
+
data.tar.gz: d467a28c0261fe8e1cfc46e6f268dbb582d40862
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5985885fe5ad19b0f3d8b69c4c909e93101ad51985a9f816b069403f342e651a6d034b9acbf21352242cae89e6e7d2fcb091cd0503d4302e8a6c6f410ece722e
|
7
|
+
data.tar.gz: b74ae8f82233134f546ef5db139d6f405055d2e909e08205e985704aa788ca04b0a2f637cb0ce42e99d9f10e4083b083ceb7dbb04aa736c11708d5560b83ff03
|
data/lib/phony/countries.rb
CHANGED
@@ -31,7 +31,7 @@ Phony.define do
|
|
31
31
|
# USA, Canada, etc.
|
32
32
|
#
|
33
33
|
country '1',
|
34
|
-
trunk('1', normalize: true) | # http://en.wikipedia.org/wiki/Trunk_prefix
|
34
|
+
trunk('1 ', normalize: true) | # http://en.wikipedia.org/wiki/Trunk_prefix
|
35
35
|
fixed(3) >> split(3,4),
|
36
36
|
:invalid_ndcs => ['911']
|
37
37
|
|
data/lib/phony/country_codes.rb
CHANGED
@@ -90,8 +90,8 @@ module Phony
|
|
90
90
|
|
91
91
|
# Formats country code and national destination code.
|
92
92
|
#
|
93
|
-
def format_cc_ndc_local format, space, cc,
|
94
|
-
cc_ndc = format_cc_ndc format, space, cc,
|
93
|
+
def format_cc_ndc_local format, space, cc, trunk, ndc, *parts
|
94
|
+
cc_ndc = format_cc_ndc format, space, cc, trunk, ndc
|
95
95
|
local = if parts.empty?
|
96
96
|
cc_ndc = cc_ndc.slice 0...cc_ndc.rindex(space.to_s)
|
97
97
|
EMPTY_STRING
|
@@ -103,7 +103,7 @@ module Phony
|
|
103
103
|
#
|
104
104
|
# TODO This method needs an overhaul.
|
105
105
|
#
|
106
|
-
def format_cc_ndc format, space, cc,
|
106
|
+
def format_cc_ndc format, space, cc, trunk, ndc
|
107
107
|
case format
|
108
108
|
when nil, :international_absolute, :international, :+
|
109
109
|
ndc ?
|
@@ -115,8 +115,8 @@ module Phony
|
|
115
115
|
@international_relative_format % [cc, nil, nil]
|
116
116
|
when :national
|
117
117
|
ndc && !ndc.empty? ?
|
118
|
-
@national_format % [
|
119
|
-
@national_format % [
|
118
|
+
@national_format % [trunk, ndc] :
|
119
|
+
@national_format % [trunk, nil]
|
120
120
|
when :local
|
121
121
|
EMPTY_STRING
|
122
122
|
end
|
data/lib/phony/trunk_code.rb
CHANGED
@@ -42,7 +42,7 @@ describe Phony::CountryCodes do
|
|
42
42
|
|
43
43
|
# Removes CC 1, but adds national call prefix 1.
|
44
44
|
#
|
45
|
-
@countries.formatted('11231231234', :format => :national).should eql '
|
45
|
+
@countries.formatted('11231231234', :format => :national).should eql '1 123 123 1234'
|
46
46
|
|
47
47
|
@countries.national_format = old_format
|
48
48
|
end
|
data/spec/lib/phony_spec.rb
CHANGED
@@ -171,7 +171,7 @@ describe Phony do
|
|
171
171
|
Phony.format('43198110', :format => :national).should eql '01 98110'
|
172
172
|
end
|
173
173
|
it 'should format US numbers with a leading trunk 1' do
|
174
|
-
Phony.format('14159224711', :format => :national).should eql '
|
174
|
+
Phony.format('14159224711', :format => :national).should eql '1 415 922 4711'
|
175
175
|
end
|
176
176
|
it 'should format Dutch numbers with a trunk code' do
|
177
177
|
Phony.format('311012341234', :format => :national).should eql '010 123 41234'
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
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-
|
11
|
+
date: 2014-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: 'Fast international phone number (E164 standard) normalizing, splitting
|
14
14
|
and formatting. Lots of formatting options: International (+.., 00..), national
|
15
15
|
(0..), and local.'
|
16
16
|
email: florian.hanke+phony@gmail.com
|
@@ -19,6 +19,9 @@ extensions: []
|
|
19
19
|
extra_rdoc_files:
|
20
20
|
- README.textile
|
21
21
|
files:
|
22
|
+
- README.textile
|
23
|
+
- lib/phony.rb
|
24
|
+
- lib/phony/countries.rb
|
22
25
|
- lib/phony/countries/austria.rb
|
23
26
|
- lib/phony/countries/bangladesh.rb
|
24
27
|
- lib/phony/countries/belarus.rb
|
@@ -57,7 +60,6 @@ files:
|
|
57
60
|
- lib/phony/countries/uruguay.rb
|
58
61
|
- lib/phony/countries/vietnam.rb
|
59
62
|
- lib/phony/countries/zimbabwe.rb
|
60
|
-
- lib/phony/countries.rb
|
61
63
|
- lib/phony/country.rb
|
62
64
|
- lib/phony/country_codes.rb
|
63
65
|
- lib/phony/dsl.rb
|
@@ -72,8 +74,6 @@ files:
|
|
72
74
|
- lib/phony/national_splitters/variable.rb
|
73
75
|
- lib/phony/trunk_code.rb
|
74
76
|
- lib/phony/vanity.rb
|
75
|
-
- lib/phony.rb
|
76
|
-
- README.textile
|
77
77
|
- spec/functional/error_spec.rb
|
78
78
|
- spec/functional/normalize_spec.rb
|
79
79
|
- spec/functional/plausibility_spec.rb
|
@@ -100,17 +100,17 @@ require_paths:
|
|
100
100
|
- lib
|
101
101
|
required_ruby_version: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- -
|
103
|
+
- - ">="
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '0'
|
106
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
requirements: []
|
112
112
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.2.2
|
114
114
|
signing_key:
|
115
115
|
specification_version: 4
|
116
116
|
summary: Fast international phone number (E164 standard) normalizing, splitting and
|
@@ -132,4 +132,3 @@ test_files:
|
|
132
132
|
- spec/lib/phony/national_splitters/variable_spec.rb
|
133
133
|
- spec/lib/phony/vanity_spec.rb
|
134
134
|
- spec/lib/phony_spec.rb
|
135
|
-
has_rdoc: false
|