global_phone_locomote 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -54,11 +54,11 @@ module GlobalPhone
54
54
  end
55
55
 
56
56
  def area_code
57
- @area_code ||= formatted_national_prefix.gsub(/[^\d]/, '')
57
+ @area_code ||= formatted_national_prefix.gsub(/[^\d]/, '') if formatted_national_prefix
58
58
  end
59
59
 
60
60
  def local_number
61
- @local_number ||= national_string_parts[2]
61
+ @local_number ||= area_code ? national_string_parts[2] : national_format
62
62
  end
63
63
 
64
64
  def valid?
@@ -97,7 +97,8 @@ module GlobalPhone
97
97
 
98
98
  def formatted_national_prefix
99
99
  @formatted_national_prefix ||= begin
100
- national_prefix_formatting_rule.gsub("$NP", national_prefix).gsub("$FG", area_code_suffix)
100
+ national_prefix_formatting_rule.gsub("$NP", national_prefix).gsub("$FG", area_code_suffix) if
101
+ national_prefix_formatting_rule
101
102
  end
102
103
  end
103
104
 
data/lib/global_phone.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'global_phone/context'
2
2
 
3
3
  module GlobalPhone
4
- VERSION = '1.0.2'
4
+ VERSION = '1.0.3'
5
5
 
6
6
  class Error < ::StandardError; end
7
7
  class NoDatabaseError < Error; end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: global_phone_locomote
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-11 00:00:00.000000000 Z
12
+ date: 2014-03-23 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: This is a fork of the wonderful sstepenson/global_phone it only exists
15
15
  because our company has a runtime dependency on this gem as part of a private gem
@@ -51,7 +51,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
51
51
  version: '0'
52
52
  segments:
53
53
  - 0
54
- hash: 4030134707792318067
54
+ hash: 2776999993341552955
55
55
  required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  none: false
57
57
  requirements:
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  version: '0'
61
61
  segments:
62
62
  - 0
63
- hash: 4030134707792318067
63
+ hash: 2776999993341552955
64
64
  requirements: []
65
65
  rubyforge_project:
66
66
  rubygems_version: 1.8.24