phony_rails 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -9,7 +9,7 @@ It uses the super awesome Phony gem (https://github.com/floere/phony).
9
9
 
10
10
  Add this line to your application's Gemfile:
11
11
 
12
- gem 'phony_number'
12
+ gem 'phony_rails'
13
13
 
14
14
  And then execute:
15
15
 
@@ -17,7 +17,7 @@ And then execute:
17
17
 
18
18
  Or install it yourself as:
19
19
 
20
- $ gem install phony_number
20
+ $ gem install phony_rails
21
21
 
22
22
  ## Usage
23
23
 
data/lib/phony_rails.rb CHANGED
@@ -26,13 +26,16 @@ module PhonyRails
26
26
  # This idea came from:
27
27
  # http://www.redguava.com.au/2011/06/rails-convert-phone-numbers-to-international-format-for-sms/
28
28
  def self.normalize_number(number, options = {})
29
- return if number.blank?
29
+ return if number.nil?
30
+ number = number.clone # Just to be sure, we don't want to change the original.
30
31
  number = Phony::CountryCodes.instance.clean(number) # Strips weird stuff from the number
32
+ return if number.blank?
31
33
  if country_number = COUNTRY_NUMBER[options[:country_code] || options[:default_country_code]]
32
34
  # Add country_number if missing
33
35
  number = "#{country_number}#{number}" if not number =~ /^(00|\+)?#{country_number}/
34
36
  end
35
37
  number = Phony.normalize(number)
38
+ return number.to_s
36
39
  rescue
37
40
  number # If all goes wrong .. we still return the original input.
38
41
  end
@@ -1,3 +1,3 @@
1
1
  module PhonyRails
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,59 +1,46 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: phony_rails
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 6
9
- version: 0.0.6
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.7
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Joost Hietbrink
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-05-16 00:00:00 +02:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-05-31 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: phony
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
16
+ requirement: &70136695162620 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
25
19
  - - ~>
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 6
30
- - 7
20
+ - !ruby/object:Gem::Version
31
21
  version: 1.6.7
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: activerecord
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
24
+ version_requirements: *70136695162620
25
+ - !ruby/object:Gem::Dependency
26
+ name: activerecord
27
+ requirement: &70136695162120 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
39
30
  - - ~>
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 3
43
- - 0
44
- version: "3.0"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.0'
45
33
  type: :runtime
46
- version_requirements: *id002
47
- description: This Gem adds useful methods to your Rails app to validate, display and save phone numbers.
48
- email:
34
+ prerelease: false
35
+ version_requirements: *70136695162120
36
+ description: This Gem adds useful methods to your Rails app to validate, display and
37
+ save phone numbers.
38
+ email:
49
39
  - joost@joopp.com
50
40
  executables: []
51
-
52
41
  extensions: []
53
-
54
42
  extra_rdoc_files: []
55
-
56
- files:
43
+ files:
57
44
  - Gemfile
58
45
  - LICENSE
59
46
  - README.md
@@ -63,35 +50,29 @@ files:
63
50
  - lib/phony_rails/version.rb
64
51
  - lib/validators/phony_validator.rb
65
52
  - phony_rails.gemspec
66
- has_rdoc: true
67
- homepage: ""
53
+ homepage: ''
68
54
  licenses: []
69
-
70
55
  post_install_message:
71
56
  rdoc_options: []
72
-
73
- require_paths:
57
+ require_paths:
74
58
  - lib
75
- required_ruby_version: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- segments:
80
- - 0
81
- version: "0"
82
- required_rubygems_version: !ruby/object:Gem::Requirement
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- segments:
87
- - 0
88
- version: "0"
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
89
71
  requirements: []
90
-
91
72
  rubyforge_project:
92
- rubygems_version: 1.3.6
73
+ rubygems_version: 1.8.15
93
74
  signing_key:
94
75
  specification_version: 3
95
- summary: This Gem adds useful methods to your Rails app to validate, display and save phone numbers.
76
+ summary: This Gem adds useful methods to your Rails app to validate, display and save
77
+ phone numbers.
96
78
  test_files: []
97
-