e164 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +9 -1
- data/VERSION +1 -1
- data/e164.gemspec +22 -23
- data/lib/e164.rb +2 -2
- data/spec/e164_spec.rb +4 -0
- metadata +35 -16
- data/.gitignore +0 -5
data/README.markdown
CHANGED
@@ -21,7 +21,7 @@ Installation
|
|
21
21
|
E164 is hosted on GemCutter, so simply run the following:
|
22
22
|
|
23
23
|
gem sources -a http://gemcutter.org
|
24
|
-
sudo gem install
|
24
|
+
sudo gem install e164
|
25
25
|
|
26
26
|
Use It!
|
27
27
|
-------
|
@@ -66,6 +66,10 @@ ToDo
|
|
66
66
|
* Add data for more areas
|
67
67
|
* Link to additional info for countries (currency, timezone, etc.)
|
68
68
|
|
69
|
+
Sponsored By
|
70
|
+
------------
|
71
|
+
This gem is sponsored by [Teliax][]. [Teliax][] makes business class Voice, [Centrex][](Including Hosted: IVRs, Ring Groups, Extensions and Day Night Mode) and Data services accessible to anyone. You don't have to be a fortune 500 to sound big!
|
72
|
+
|
69
73
|
Note on Patches/Pull Requests
|
70
74
|
-----------------------------
|
71
75
|
|
@@ -82,3 +86,7 @@ Copyright
|
|
82
86
|
---------
|
83
87
|
|
84
88
|
Copyright (c) 2009 hexorx. See LICENSE for details.
|
89
|
+
|
90
|
+
|
91
|
+
[Teliax]: http://teliax.com
|
92
|
+
[Centrex]: http://en.wikipedia.org/wiki/Centrex
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/e164.gemspec
CHANGED
@@ -1,55 +1,53 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{e164}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["hexorx"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-03-21}
|
13
13
|
s.description = %q{The e164 gem can parse and normalize numbers into the e164 format.
|
14
14
|
It provides extra information on the Country Code and National Destination Codes.
|
15
15
|
It can be used standalone or mixed into a model.}
|
16
16
|
s.email = %q{hexorx@gmail.com}
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE",
|
19
|
-
|
19
|
+
"README.markdown"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
"spec/spec_helper.rb"
|
23
|
+
"LICENSE",
|
24
|
+
"README.markdown",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"e164.gemspec",
|
28
|
+
"lib/e164.rb",
|
29
|
+
"lib/e164/country_codes.rb",
|
30
|
+
"lib/e164/national_destination_codes/austria.rb",
|
31
|
+
"lib/e164/national_destination_codes/germany.rb",
|
32
|
+
"lib/e164/national_destination_codes/nanp.rb",
|
33
|
+
"lib/load_data.sql",
|
34
|
+
"spec/e164_spec.rb",
|
35
|
+
"spec/spec_helper.rb"
|
37
36
|
]
|
38
37
|
s.homepage = %q{http://github.com/hexorx/e164}
|
39
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
40
38
|
s.require_paths = ["lib"]
|
41
|
-
s.rubygems_version = %q{1.3.
|
39
|
+
s.rubygems_version = %q{1.3.7}
|
42
40
|
s.summary = %q{This gem provides e164 parsing and normalization}
|
43
41
|
s.test_files = [
|
44
42
|
"spec/e164_spec.rb",
|
45
|
-
|
43
|
+
"spec/spec_helper.rb"
|
46
44
|
]
|
47
45
|
|
48
46
|
if s.respond_to? :specification_version then
|
49
47
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
48
|
s.specification_version = 3
|
51
49
|
|
52
|
-
if Gem::Version.new(Gem::
|
50
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
51
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
54
52
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
55
53
|
else
|
@@ -61,3 +59,4 @@ Gem::Specification.new do |s|
|
|
61
59
|
s.add_dependency(%q<yard>, [">= 0"])
|
62
60
|
end
|
63
61
|
end
|
62
|
+
|
data/lib/e164.rb
CHANGED
@@ -46,9 +46,9 @@ module E164
|
|
46
46
|
when Hash
|
47
47
|
potentials = destination_codes[:range].map {|l| num[1,l].join}
|
48
48
|
destination_code = potentials.map {|x| destination_codes[x] ? x : nil}.compact.first
|
49
|
-
destination_code_length = destination_code.length || destination_codes[:default]
|
49
|
+
destination_code_length = (destination_code && destination_code.length) || destination_codes[:default]
|
50
50
|
end
|
51
51
|
|
52
52
|
[num.shift, num.shift(destination_code_length).join, *num]
|
53
53
|
end
|
54
|
-
end
|
54
|
+
end
|
data/spec/e164_spec.rb
CHANGED
@@ -21,5 +21,9 @@ describe E164 do
|
|
21
21
|
it 'should not add country code if it already starts with the default country code and no identifier' do
|
22
22
|
E164.normalize('13035559850').should == "+13035559850"
|
23
23
|
end
|
24
|
+
|
25
|
+
it "shouldn't die on german numbers" do
|
26
|
+
lambda { E164.normalize('+4988612345670') }.should_not raise_error
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: e164
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 31
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- hexorx
|
@@ -9,29 +15,37 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2011-03-21 00:00:00 -06:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
23
32
|
version: "0"
|
24
|
-
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
25
35
|
- !ruby/object:Gem::Dependency
|
26
36
|
name: yard
|
27
|
-
|
28
|
-
|
29
|
-
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
30
40
|
requirements:
|
31
41
|
- - ">="
|
32
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
33
46
|
version: "0"
|
34
|
-
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id002
|
35
49
|
description: |-
|
36
50
|
The e164 gem can parse and normalize numbers into the e164 format.
|
37
51
|
It provides extra information on the Country Code and National Destination Codes.
|
@@ -46,7 +60,6 @@ extra_rdoc_files:
|
|
46
60
|
- README.markdown
|
47
61
|
files:
|
48
62
|
- .document
|
49
|
-
- .gitignore
|
50
63
|
- LICENSE
|
51
64
|
- README.markdown
|
52
65
|
- Rakefile
|
@@ -65,26 +78,32 @@ homepage: http://github.com/hexorx/e164
|
|
65
78
|
licenses: []
|
66
79
|
|
67
80
|
post_install_message:
|
68
|
-
rdoc_options:
|
69
|
-
|
81
|
+
rdoc_options: []
|
82
|
+
|
70
83
|
require_paths:
|
71
84
|
- lib
|
72
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
73
87
|
requirements:
|
74
88
|
- - ">="
|
75
89
|
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
76
93
|
version: "0"
|
77
|
-
version:
|
78
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
79
96
|
requirements:
|
80
97
|
- - ">="
|
81
98
|
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
82
102
|
version: "0"
|
83
|
-
version:
|
84
103
|
requirements: []
|
85
104
|
|
86
105
|
rubyforge_project:
|
87
|
-
rubygems_version: 1.3.
|
106
|
+
rubygems_version: 1.3.7
|
88
107
|
signing_key:
|
89
108
|
specification_version: 3
|
90
109
|
summary: This gem provides e164 parsing and normalization
|