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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{big-phoney}
5
- s.version = "0.1.1"
5
+ s.version = "0.1.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Pat Nakajima", "Brandon Keene"]
@@ -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 and not [1].include?(BigPhoney::PhoneNumber.new(number).country_code.to_i)
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: 25
5
- prerelease: false
4
+ hash: 31
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.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.3.7
73
+ rubygems_version: 1.4.1
74
74
  signing_key:
75
75
  specification_version: 3
76
76
  summary: Simple phone number parsing in Ruby