phoner 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/lib/phoner/phone.rb +2 -1
- data/lib/phoner/version.rb +1 -1
- data/test/phone_test.rb +4 -4
- metadata +3 -4
- data/Gemfile.lock +0 -31
data/.gitignore
CHANGED
data/lib/phoner/phone.rb
CHANGED
@@ -66,10 +66,11 @@ module Phoner
|
|
66
66
|
options[:country_code] ||= self.default_country_code
|
67
67
|
options[:area_code] ||= self.default_area_code
|
68
68
|
|
69
|
+
parts = nil
|
70
|
+
|
69
71
|
if options[:country_code].is_a?(Array)
|
70
72
|
options[:country_code].find do |country_code|
|
71
73
|
parts = split_to_parts(normalized, options.merge(:country_code => country_code))
|
72
|
-
return parts if parts
|
73
74
|
end
|
74
75
|
else
|
75
76
|
parts = split_to_parts(normalized, options)
|
data/lib/phoner/version.rb
CHANGED
data/test/phone_test.rb
CHANGED
@@ -112,10 +112,10 @@ class PhoneTest < Phoner::TestCase
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def test_parse_with_multiple_country_codes
|
115
|
-
assert_equal Phoner::Phone.parse('915125486', :country_code => ['385', '47'])
|
116
|
-
assert_equal Phoner::Phone.parse('915125486', :country_code => ['47', '385'])
|
117
|
-
assert_equal Phoner::Phone.parse('90123456', :country_code => ['385', '47'])
|
118
|
-
assert_equal Phoner::Phone.parse('90123456', :country_code => ['47', '385'])
|
115
|
+
assert_equal Phoner::Phone.parse('915125486', :country_code => ['385', '47']).country_code, '385'
|
116
|
+
assert_equal Phoner::Phone.parse('915125486', :country_code => ['47', '385']).country_code, '385'
|
117
|
+
assert_equal Phoner::Phone.parse('90123456', :country_code => ['385', '47']).country_code, '47'
|
118
|
+
assert_equal Phoner::Phone.parse('90123456', :country_code => ['47', '385']).country_code, '47'
|
119
119
|
|
120
120
|
assert_equal Phoner::Phone.valid?('90123456', :country_code => ['385', '47']), true
|
121
121
|
assert_equal Phoner::Phone.valid?('915125486', :country_code => ['385', '47']), true
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: phoner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version:
|
5
|
+
version: 1.0.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tomislav Car
|
@@ -60,7 +60,6 @@ extra_rdoc_files: []
|
|
60
60
|
files:
|
61
61
|
- .gitignore
|
62
62
|
- Gemfile
|
63
|
-
- Gemfile.lock
|
64
63
|
- LICENSE.txt
|
65
64
|
- README.md
|
66
65
|
- Rakefile
|
@@ -150,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
149
|
- !ruby/object:Gem::Version
|
151
150
|
segments:
|
152
151
|
- 0
|
153
|
-
hash:
|
152
|
+
hash: 727197279702819293
|
154
153
|
version: '0'
|
155
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
155
|
none: false
|
@@ -159,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
158
|
- !ruby/object:Gem::Version
|
160
159
|
segments:
|
161
160
|
- 0
|
162
|
-
hash:
|
161
|
+
hash: 727197279702819293
|
163
162
|
version: '0'
|
164
163
|
requirements: []
|
165
164
|
rubyforge_project:
|
data/Gemfile.lock
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
phoner (1.0)
|
5
|
-
activesupport
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
activesupport (3.2.9)
|
11
|
-
i18n (~> 0.6)
|
12
|
-
multi_json (~> 1.0)
|
13
|
-
columnize (0.3.6)
|
14
|
-
debugger (1.2.2)
|
15
|
-
columnize (>= 0.3.1)
|
16
|
-
debugger-linecache (~> 1.1.1)
|
17
|
-
debugger-ruby_core_source (~> 1.1.5)
|
18
|
-
debugger-linecache (1.1.2)
|
19
|
-
debugger-ruby_core_source (>= 1.1.1)
|
20
|
-
debugger-ruby_core_source (1.1.5)
|
21
|
-
i18n (0.6.1)
|
22
|
-
multi_json (1.3.7)
|
23
|
-
rake (10.0.2)
|
24
|
-
|
25
|
-
PLATFORMS
|
26
|
-
ruby
|
27
|
-
|
28
|
-
DEPENDENCIES
|
29
|
-
debugger
|
30
|
-
phoner!
|
31
|
-
rake
|