phony 2.11.1 → 2.12.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 +4 -4
- data/lib/phony/country_codes.rb +5 -2
- data/spec/functional/format_spec.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ed5de3b041644628bf1c702210e88291f7bbb20
|
4
|
+
data.tar.gz: 56b7326025d25289a02bc7feb0847be683cace10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dbf4c9482be5886e586fc60e6258597f1942c06b062f7d9d4b1c5e54e1d38d5e67f66557c943aac08b60aea72824bc1f3addfa9f10027d9a411ae58fc330351
|
7
|
+
data.tar.gz: 7333d68cc3b7b15c143a18c85b54ef44ed6c034aab3328a7582aea4352d4020e1d8aa54a3237421233f6c0a80863cd62ec10c5d560a072313de4c8ffa9682b4d
|
data/lib/phony/country_codes.rb
CHANGED
@@ -90,12 +90,15 @@ module Phony
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def format number, options = {}
|
93
|
-
country, *
|
93
|
+
country, cc, trunk, ndc, *parts = internal_split number
|
94
94
|
format_cc_ndc_local \
|
95
95
|
options[:format] || country.format,
|
96
96
|
options[:spaces] || country.space || @default_space,
|
97
97
|
options[:local_spaces] || country.local_space || options[:spaces] || @default_local_space,
|
98
|
-
|
98
|
+
cc,
|
99
|
+
options[:trunk] == false ? nil : trunk,
|
100
|
+
ndc,
|
101
|
+
*parts
|
99
102
|
end
|
100
103
|
alias formatted format
|
101
104
|
|
@@ -40,8 +40,6 @@ describe 'Phony#format' do
|
|
40
40
|
it 'formats Swiss national numbers' do
|
41
41
|
Phony.format('41443643532', :format => :national).should eql '044 364 35 32'
|
42
42
|
end
|
43
|
-
# TODO
|
44
|
-
#
|
45
43
|
it 'formats Swiss service numbers' do
|
46
44
|
Phony.format('41800112233').should eql '+41 800 112 233'
|
47
45
|
end
|
@@ -86,6 +84,12 @@ describe 'Phony#format' do
|
|
86
84
|
it 'formats north american numbers' do
|
87
85
|
Phony.format('18091231234', :format => :international).should eql '+1 809 123 1234'
|
88
86
|
end
|
87
|
+
it 'formats north american numbers' do
|
88
|
+
# Gets a trunk code.
|
89
|
+
Phony.format('14152223333', :format => :national).should eql '1 415 222 3333'
|
90
|
+
# Does not show a trunk code.
|
91
|
+
Phony.format('14152223333', :format => :national, :trunk => false).should eql '415 222 3333'
|
92
|
+
end
|
89
93
|
it 'formats austrian numbers' do
|
90
94
|
Phony.format('43198110', :format => :international).should eql '+43 1 98110'
|
91
95
|
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.
|
4
|
+
version: 2.12.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: 2015-
|
11
|
+
date: 2015-03-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
|