big-phoney 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/big-phoney.gemspec +1 -1
- data/lib/big_phoney/rails.rb +2 -1
- metadata +5 -5
data/big-phoney.gemspec
CHANGED
data/lib/big_phoney/rails.rb
CHANGED
@@ -12,11 +12,12 @@ module BigPhoney
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def validate_phone(*args)
|
15
|
+
options = args.extract_options!
|
15
16
|
args.each do |attribute|
|
16
17
|
validate do |record|
|
17
18
|
number = record.send(attribute)
|
18
19
|
|
19
|
-
if number
|
20
|
+
if options[:us_only] && number && ![1].include?(BigPhoney::PhoneNumber.new(number).country_code.to_i)
|
20
21
|
record.errors[attribute] << "must be a valid US phone number"
|
21
22
|
end
|
22
23
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: big-phoney
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 31
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pat Nakajima
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
requirements: []
|
71
71
|
|
72
72
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.
|
73
|
+
rubygems_version: 1.4.1
|
74
74
|
signing_key:
|
75
75
|
specification_version: 3
|
76
76
|
summary: Simple phone number parsing in Ruby
|