phony_rails 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,32 +1,38 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- phony_rails (0.6.1)
4
+ phony_rails (0.7.0)
5
5
  activesupport (>= 3.0)
6
6
  countries (>= 0.8.2)
7
- phony (~> 2.1)
7
+ phony (~> 2.3.0)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activemodel (3.2.14)
13
- activesupport (= 3.2.14)
14
- builder (~> 3.0.0)
15
- activerecord (3.2.14)
16
- activemodel (= 3.2.14)
17
- activesupport (= 3.2.14)
18
- arel (~> 3.0.2)
19
- tzinfo (~> 0.3.29)
20
- activesupport (3.2.14)
21
- i18n (~> 0.6, >= 0.6.4)
22
- multi_json (~> 1.0)
23
- arel (3.0.2)
24
- builder (3.0.4)
25
- countries (0.9.2)
26
- currencies (>= 0.4.0)
12
+ activemodel (4.1.6)
13
+ activesupport (= 4.1.6)
14
+ builder (~> 3.1)
15
+ activerecord (4.1.6)
16
+ activemodel (= 4.1.6)
17
+ activesupport (= 4.1.6)
18
+ arel (~> 5.0.0)
19
+ activesupport (4.1.6)
20
+ i18n (~> 0.6, >= 0.6.9)
21
+ json (~> 1.7, >= 1.7.7)
22
+ minitest (~> 5.1)
23
+ thread_safe (~> 0.1)
24
+ tzinfo (~> 1.1)
25
+ arel (5.0.1.20140414130214)
26
+ bson (2.3.0)
27
+ builder (3.2.2)
28
+ celluloid (0.16.0)
29
+ timers (~> 4.0.0)
30
+ connection_pool (2.0.0)
31
+ countries (0.9.3)
32
+ currencies (~> 0.4.2)
27
33
  currencies (0.4.2)
28
34
  diff-lcs (1.1.3)
29
- ffi (1.9.0)
35
+ ffi (1.9.5)
30
36
  growl (1.0.3)
31
37
  guard (1.2.3)
32
38
  listen (>= 0.4.2)
@@ -36,25 +42,29 @@ GEM
36
42
  guard (~> 1.1)
37
43
  guard-rspec (1.2.1)
38
44
  guard (>= 1.1)
39
- i18n (0.6.5)
40
- listen (1.3.0)
45
+ hitimes (1.2.2)
46
+ i18n (0.6.11)
47
+ json (1.8.1)
48
+ listen (2.7.11)
49
+ celluloid (>= 0.15.2)
41
50
  rb-fsevent (>= 0.9.3)
42
51
  rb-inotify (>= 0.9)
43
- rb-kqueue (>= 0.2)
44
- mongoid (3.1.4)
45
- activemodel (~> 3.2)
46
- moped (~> 1.4)
47
- origin (~> 1.0)
48
- tzinfo (~> 0.3.22)
49
- moped (1.5.1)
50
- multi_json (1.7.9)
51
- origin (1.1.0)
52
- phony (2.1.3)
53
- rake (10.1.0)
54
- rb-fsevent (0.9.3)
55
- rb-inotify (0.9.1)
56
- ffi (>= 0.5.0)
57
- rb-kqueue (0.2.0)
52
+ minitest (5.4.2)
53
+ mongoid (4.0.0)
54
+ activemodel (~> 4.0)
55
+ moped (~> 2.0.0)
56
+ origin (~> 2.1)
57
+ tzinfo (>= 0.3.37)
58
+ moped (2.0.0)
59
+ bson (~> 2.2)
60
+ connection_pool (~> 2.0)
61
+ optionable (~> 0.2.0)
62
+ optionable (0.2.0)
63
+ origin (2.1.1)
64
+ phony (2.3.0)
65
+ rake (10.3.2)
66
+ rb-fsevent (0.9.4)
67
+ rb-inotify (0.9.5)
58
68
  ffi (>= 0.5.0)
59
69
  rspec (2.11.0)
60
70
  rspec-core (~> 2.11.0)
@@ -64,9 +74,13 @@ GEM
64
74
  rspec-expectations (2.11.3)
65
75
  diff-lcs (~> 1.1.3)
66
76
  rspec-mocks (2.11.3)
67
- sqlite3 (1.3.8)
68
- thor (0.18.1)
69
- tzinfo (0.3.37)
77
+ sqlite3 (1.3.9)
78
+ thor (0.19.1)
79
+ thread_safe (0.3.4)
80
+ timers (4.0.1)
81
+ hitimes
82
+ tzinfo (1.2.2)
83
+ thread_safe (~> 0.1)
70
84
 
71
85
  PLATFORMS
72
86
  ruby
data/README.md CHANGED
@@ -121,6 +121,11 @@ Say you want to find a record by a phone number. Best is to normalize user input
121
121
 
122
122
  ## Changelog
123
123
 
124
+ 0.7.0
125
+ * Gem update.
126
+ * Pinned Phony to v2.3.0.
127
+ * Fixed regex.
128
+
124
129
  0.6.0
125
130
  * Support for Phony 2.1 by @pjg.
126
131
 
data/lib/phony_rails.rb CHANGED
@@ -25,12 +25,11 @@ module PhonyRails
25
25
  return if number.blank?
26
26
  if country_number = options[:country_number] || country_number_for(options[:country_code])
27
27
  # (Force) add country_number if missing
28
- number = "#{country_number}#{number}" if not number =~ /^(00|\+)?#{country_number}/
28
+ number = "#{country_number}#{number}" if not number =~ /\A(00|\+)?#{country_number}/
29
29
  elsif default_country_number = options[:default_country_number] || country_number_for(options[:default_country_code])
30
30
  # Add default_country_number if missing
31
- number = "#{default_country_number}#{number}" if not number =~ /^(00|\+|#{default_country_number})/
31
+ number = "#{default_country_number}#{number}" if not number =~ /\A(00|\+|#{default_country_number})/
32
32
  end
33
-
34
33
  Phony.normalize(number)
35
34
  rescue
36
35
  number # If all goes wrong .. we still return the original input.
@@ -1,3 +1,3 @@
1
1
  module PhonyRails
2
- VERSION = "0.6.2"
2
+ VERSION = "0.7.0"
3
3
  end
data/phony_rails.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = PhonyRails::VERSION
18
18
 
19
- gem.add_dependency "phony", "~> 2.1"
19
+ gem.add_dependency "phony", "~> 2.3.0"
20
20
  gem.add_dependency "countries", ">= 0.8.2"
21
21
  gem.add_dependency "activesupport", ">= 3.0"
22
22
  gem.add_development_dependency "activerecord", ">= 3.0"
@@ -148,7 +148,8 @@ describe PhonyRails do
148
148
  PhonyRails.normalize_number('070-4157134', :country_code => 'NL').should eql('31704157134')
149
149
  PhonyRails.normalize_number('0031-70-4157134', :country_code => 'NL').should eql('31704157134')
150
150
  PhonyRails.normalize_number('+31-70-4157134', :country_code => 'NL').should eql('31704157134')
151
- PhonyRails.normalize_number('0323-2269497', :country_code => 'BE').should eql('3232269497')
151
+ PhonyRails.normalize_number('0322-69497', :country_code => 'BE').should eql('3232269497')
152
+ PhonyRails.normalize_number('+32 3 226 94 97', :country_code => 'BE').should eql('3232269497')
152
153
  end
153
154
 
154
155
  it "should normalize even an implausible number" do
@@ -71,13 +71,13 @@ end
71
71
  #--------------------
72
72
  class FormattedHelpfulHome < ActiveRecord::Base
73
73
  attr_accessor :phone_number
74
- validates_plausible_phone :phone_number, :with => /^\+\d+/
74
+ validates_plausible_phone :phone_number, :with => /\A\+\d+/
75
75
  end
76
76
 
77
77
  #--------------------
78
78
  class NotFormattedHelpfulHome < ActiveRecord::Base
79
79
  attr_accessor :phone_number
80
- validates_plausible_phone :phone_number, :without => /^\+\d+/
80
+ validates_plausible_phone :phone_number, :without => /\A\+\d+/
81
81
  end
82
82
 
83
83
  #--------------------
@@ -95,7 +95,7 @@ end
95
95
  #--------------------
96
96
  class BigHelpfulHome < ActiveRecord::Base
97
97
  attr_accessor :phone_number
98
- validates_plausible_phone :phone_number, :presence => true, :with => /^\+\d+/, :country_number => "33"
98
+ validates_plausible_phone :phone_number, :presence => true, :with => /\A\+\d+/, :country_number => "33"
99
99
  end
100
100
 
101
101
  #-----------------------------------------------------------------------------------------------------------------------
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
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: 2014-08-29 00:00:00.000000000 Z
12
+ date: 2014-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: phony
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '2.1'
21
+ version: 2.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '2.1'
29
+ version: 2.3.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: countries
32
32
  requirement: !ruby/object:Gem::Requirement