countries-phone_numbers 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e01743be9db3b672170580db4f87af93098682b
4
- data.tar.gz: f7ee78a09bebc978aa02c1260d29e86e1fec35e7
3
+ metadata.gz: 73aa4e1c2d1502535d08993e53b1d8cb56731a9f
4
+ data.tar.gz: 8e315ad315ebb4680df7496ff82258c27d8066cf
5
5
  SHA512:
6
- metadata.gz: 7ef8f13cbb4faae29eb73b7bdcdaf163de76f6695648aa9545e0fcd1b1aa8f9e3feac59aa3f4b5d28a41858e273872eaa72abe18e68eb5a223d2ac3b0580c689
7
- data.tar.gz: 017cd3072663ce7c2c39905adde84874f5a02959030c884d379c6566e892a0f80864bd4bbde511c9926871fb9718ceebf06c2c3da3d5e3bfd10758701f040810
6
+ metadata.gz: 3c8bed726e415737eca3ea216b29d6b19396f2c7b641371eff7e71940dff09dd0c26189fcff1c48f94fbb3ef04d8e36a5fbfee902d69b258bbbdefd7dce71beb
7
+ data.tar.gz: 1059811a467a47700be9288045f8260de6640e43aeeec561f453fb8d7f7623b4652e26db689b128ec42617a27c19dbbdf5b93a3c4887df6eb30106dfa721dc35
@@ -5,7 +5,7 @@ module Countries::PhoneNumbers::Extensions
5
5
  end
6
6
 
7
7
  def format_phone_number( number, options={} )
8
- Phony.formatted( number, options )
8
+ Phony.formatted( Phony.normalize( number ), options )
9
9
  end
10
10
 
11
11
  def format_local_phone_number( number, options={} )
@@ -1,5 +1,5 @@
1
1
  module Countries
2
2
  module PhoneNumbers
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@ require "countries/phone_numbers/version"
4
4
  require 'countries'
5
5
  require 'phony'
6
6
 
7
- # Country::PhoneNumber
7
+ # Countries::PhoneNumber
8
8
  require 'countries/phone_numbers/extensions'
9
9
  require 'countries/phone_numbers/detector_factory'
10
10
  require 'countries/phone_numbers/detector'
@@ -16,8 +16,8 @@ require 'countries/phone_numbers/start_with_detector'
16
16
 
17
17
  module Countries
18
18
  module PhoneNumbers
19
- extend Extensions::ClassMethods
20
- DATA_FILE = File.join( 'lib', 'countries', 'phone_numbers', 'detectors.yaml' )
19
+ include Extensions
20
+ DATA_FILE = File.join( File.dirname(__FILE__), 'phone_numbers', 'detectors.yaml' )
21
21
 
22
22
  ##
23
23
  # Find all countries with shared country codes.
@@ -5,23 +5,23 @@ describe ISO3166::Country, '#find_*_by_phone_number' do
5
5
 
6
6
  # Test a bogus phone number
7
7
  it 'ignores bogus phone numbers (single digit)' do
8
- Country.find_country_by_phone_number( '5' ).should == nil
8
+ subject.find_country_by_phone_number( '5' ).should == nil
9
9
  end
10
10
 
11
11
  # Test another bogus phone number
12
12
  it 'ignores bogus phone numbers (text)' do
13
- Country.find_country_by_phone_number( 'abc' ).should == nil
13
+ subject.find_country_by_phone_number( 'abc' ).should == nil
14
14
  end
15
15
 
16
16
  # Test all data given in the 'TEST' block (defined in the spec helper)
17
17
  TEST_DATA.each do |alpha2, numbers|
18
18
  numbers.each do |number|
19
19
  it "recognises #{number} as #{alpha2.to_s}" do
20
- Country.find_country_by_phone_number(number).should_not be_nil
21
- Country.find_country_by_phone_number(number).alpha2.should == alpha2.to_s
20
+ subject.find_country_by_phone_number(number).should_not be_nil
21
+ subject.find_country_by_phone_number(number).alpha2.should == alpha2.to_s
22
22
  end
23
23
  it "returns only one country for #{number}" do
24
- Country.find_all_countries_by_phone_number(number).should have(1).country
24
+ subject.find_all_countries_by_phone_number(number).should have(1).country
25
25
  end
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: countries-phone_numbers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Lloyd