phony 2.11.1 → 2.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 233732f4d1bf6ce31b1b1898b2992f1d3b9f4ecf
4
- data.tar.gz: 7b168117a199172b6f4a1deda2aec9eecd7f8c5c
3
+ metadata.gz: 9ed5de3b041644628bf1c702210e88291f7bbb20
4
+ data.tar.gz: 56b7326025d25289a02bc7feb0847be683cace10
5
5
  SHA512:
6
- metadata.gz: ecfcfb419063cf705ca34c6e52cece232e2b6bcb5c9309fa682358d6899dbe04ab1e6dc3ad357b1e1051875fd5cf21e4d13864f6731d6045fa198a73208e59a7
7
- data.tar.gz: 61895d573728dc7af4a9f621a7e70c2551f38b462cec9f98cc3f0ed20824275786a909340d84ac79c6f5f5bcb5e7d525cb6ebeafaa2be17984e459c401ea5304
6
+ metadata.gz: 6dbf4c9482be5886e586fc60e6258597f1942c06b062f7d9d4b1c5e54e1d38d5e67f66557c943aac08b60aea72824bc1f3addfa9f10027d9a411ae58fc330351
7
+ data.tar.gz: 7333d68cc3b7b15c143a18c85b54ef44ed6c034aab3328a7582aea4352d4020e1d8aa54a3237421233f6c0a80863cd62ec10c5d560a072313de4c8ffa9682b4d
@@ -90,12 +90,15 @@ module Phony
90
90
  end
91
91
 
92
92
  def format number, options = {}
93
- country, *split_number = internal_split number
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
- *split_number
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.11.1
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-02-27 00:00:00.000000000 Z
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