phony_number 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,13 +21,14 @@ module PhonyNumber
21
21
 
22
22
  # This method requires a country_code attribute (eg. NL) and phone_number to be set.
23
23
  # Options:
24
- # :country_code => Some code that can be used as default.
24
+ # :country_code => The country code we should use.
25
+ # :default_country_code => Some fallback code (eg. 'NL') that can be used as default (comes from phony_normalize_numbers method).
25
26
  def self.normalize_number(number, options = {})
26
27
  return if number.blank?
27
28
  number = Phony.normalize(number) # TODO: Catch errors
28
29
  if country_number = COUNTRY_NUMBER[options[:country_code] || options[:default_country_code]]
29
30
  # Add country_number if missing
30
- number = "#{country_number}#{number}" not number =~ /^(00|\+)?#{country_number}/
31
+ number = "#{country_number}#{number}" if not number =~ /^(00|\+)?#{country_number}/
31
32
  end
32
33
  number = Phony.normalize(number)
33
34
  rescue
@@ -65,7 +66,7 @@ module PhonyNumber
65
66
  # It checks your model object for a a country_code attribute (eg. 'NL') to do the normalizing so make sure
66
67
  # you've geocoded before calling this method!
67
68
  def phony_normalize_numbers(*attributes)
68
- options = attributes.last.is_a?(Hash) ? attributes.last : {}
69
+ options = attributes.last.is_a?(Hash) ? attributes.last : {}
69
70
  attributes.each do |attribute|
70
71
  # Add before validation that saves a normalized version of the phone number
71
72
  self.before_validation do
@@ -1,3 +1,3 @@
1
1
  module PhonyNumber
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-05-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: phony
16
- requirement: &70331117147140 !ruby/object:Gem::Requirement
16
+ requirement: &70099055470980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.6.7
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70331117147140
24
+ version_requirements: *70099055470980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activerecord
27
- requirement: &70331117145660 !ruby/object:Gem::Requirement
27
+ requirement: &70099055469200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '3.0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70331117145660
35
+ version_requirements: *70099055469200
36
36
  description: This Gem adds useful methods to your Rails app to validate, display and
37
37
  save phone numbers.
38
38
  email: