phony_rails 0.1.9 → 0.1.10

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,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- phony_rails (0.1.8)
4
+ phony_rails (0.1.10)
5
5
  activerecord (~> 3.0)
6
6
  countries (~> 0.8.2)
7
7
  phony (~> 1.7.7)
@@ -43,7 +43,7 @@ GEM
43
43
  rb-fsevent (~> 0.9.1)
44
44
  rb-inotify (~> 0.8.8)
45
45
  multi_json (1.3.6)
46
- phony (1.7.7)
46
+ phony (1.7.10)
47
47
  rb-fchange (0.0.5)
48
48
  ffi
49
49
  rb-fsevent (0.9.1)
data/README.md CHANGED
@@ -78,6 +78,10 @@ Say you want to find a record by a phone number. Best is to normalize user input
78
78
 
79
79
  ## Changelog
80
80
 
81
+ 0.1.10
82
+ * Changes from henning-koch.
83
+ * Some pending fixes.
84
+
81
85
  0.1.8
82
86
  * Improved validation methods by ddidier.
83
87
 
@@ -122,3 +126,5 @@ Say you want to find a record by a phone number. Best is to normalize user input
122
126
  3. Commit your changes (`git commit -am 'Added some feature'`)
123
127
  4. Push to the branch (`git push origin my-new-feature`)
124
128
  5. Create new Pull Request
129
+
130
+ Thanks to all contributors: ddidier, brutuscat, henning-koch.
data/lib/phony_rails.rb CHANGED
@@ -68,7 +68,7 @@ module PhonyRails
68
68
  options.assert_valid_keys :country_code, :default_country_code, :as
69
69
  if options[:as].present?
70
70
  raise ArgumentError, ':as option can not be used on phony_normalize with multiple attribute names! (PhonyRails)' if attributes.size > 1
71
- raise ArgumentError, "'#{options[:as]}' is not an attribute on #{self.class}. You might want to use 'phony_normalized_method :#{attributes.first}' (PhonyRails)" if not self.attribute_method?(options[:as])
71
+ raise ArgumentError, "'#{options[:as]}' is not an attribute on #{self.name}. You might want to use 'phony_normalized_method :#{attributes.first}' (PhonyRails)" if not self.attribute_method?(options[:as])
72
72
  end
73
73
  attributes.each do |attribute|
74
74
  raise ArgumentError, "No attribute #{attribute} found on #{self.name} (PhonyRails)" if not self.attribute_method?(attribute)
@@ -86,8 +86,9 @@ module PhonyRails
86
86
  main_options = attributes.last.is_a?(Hash) ? attributes.pop : {}
87
87
  main_options.assert_valid_keys :country_code, :default_country_code
88
88
  attributes.each do |attribute|
89
- raise StandardError, "Instance method normalized_#{attribute} already exists on #{self.name} (PhonyRails)" if self.instance_methods.include?(:"normalized_#{attribute}")
90
- define_method :"normalized_#{attribute}" do |options = {}|
89
+ raise StandardError, "Instance method normalized_#{attribute} already exists on #{self.name} (PhonyRails)" if method_defined?(:"normalized_#{attribute}")
90
+ define_method :"normalized_#{attribute}" do |*args|
91
+ options = args.first || {}
91
92
  raise ArgumentError, "No attribute/method #{attribute} found on #{self.class.name} (PhonyRails)" if not self.respond_to?(attribute)
92
93
  options[:country_code] ||= self.country_code if self.respond_to?(:country_code)
93
94
  PhonyRails.normalize_number(self.send(attribute), main_options.merge(options))
@@ -1,3 +1,3 @@
1
1
  module PhonyRails
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
@@ -62,7 +62,7 @@ describe PhonyRails do
62
62
  }.should raise_error(ArgumentError)
63
63
  end
64
64
 
65
- it "should not accept :as option with unexiting attribute name" do
65
+ it "should not accept :as option with unexisting attribute name" do
66
66
  lambda {
67
67
  Home.phony_normalize(:non_existing_attribute, :as => 'non_existing_attribute')
68
68
  }.should raise_error(ArgumentError)
metadata CHANGED
@@ -1,72 +1,73 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: phony_rails
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.9
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 10
9
+ version: 0.1.10
6
10
  platform: ruby
7
- authors:
11
+ authors:
8
12
  - Joost Hietbrink
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
- date: 2012-08-13 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
16
+
17
+ date: 2012-10-18 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: phony
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 1.7.7
22
- type: :runtime
23
22
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
27
25
  - - ~>
28
- - !ruby/object:Gem::Version
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 7
30
+ - 7
29
31
  version: 1.7.7
30
- - !ruby/object:Gem::Dependency
31
- name: countries
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: 0.8.2
38
32
  type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: countries
39
36
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
43
39
  - - ~>
44
- - !ruby/object:Gem::Version
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 8
44
+ - 2
45
45
  version: 0.8.2
46
- - !ruby/object:Gem::Dependency
47
- name: activerecord
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ~>
52
- - !ruby/object:Gem::Version
53
- version: '3.0'
54
46
  type: :runtime
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: activerecord
55
50
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ requirements:
59
53
  - - ~>
60
- - !ruby/object:Gem::Version
61
- version: '3.0'
62
- description: This Gem adds useful methods to your Rails app to validate, display and
63
- save phone numbers.
64
- email:
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 3
57
+ - 0
58
+ version: "3.0"
59
+ type: :runtime
60
+ version_requirements: *id003
61
+ description: This Gem adds useful methods to your Rails app to validate, display and save phone numbers.
62
+ email:
65
63
  - joost@joopp.com
66
64
  executables: []
65
+
67
66
  extensions: []
67
+
68
68
  extra_rdoc_files: []
69
- files:
69
+
70
+ files:
70
71
  - .gitignore
71
72
  - .rspec
72
73
  - Gemfile
@@ -85,33 +86,37 @@ files:
85
86
  - spec/lib/phony_rails_spec.rb
86
87
  - spec/lib/validators/phony_validator_spec.rb
87
88
  - spec/spec_helper.rb
89
+ has_rdoc: true
88
90
  homepage: https://github.com/joost/phony_rails
89
91
  licenses: []
92
+
90
93
  post_install_message:
91
94
  rdoc_options: []
92
- require_paths:
95
+
96
+ require_paths:
93
97
  - lib
94
- required_ruby_version: !ruby/object:Gem::Requirement
95
- none: false
96
- requirements:
97
- - - ! '>='
98
- - !ruby/object:Gem::Version
99
- version: '0'
100
- required_rubygems_version: !ruby/object:Gem::Requirement
101
- none: false
102
- requirements:
103
- - - ! '>='
104
- - !ruby/object:Gem::Version
105
- version: '0'
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ segments:
110
+ - 0
111
+ version: "0"
106
112
  requirements: []
113
+
107
114
  rubyforge_project:
108
- rubygems_version: 1.8.24
115
+ rubygems_version: 1.3.6
109
116
  signing_key:
110
117
  specification_version: 3
111
- summary: This Gem adds useful methods to your Rails app to validate, display and save
112
- phone numbers.
113
- test_files:
118
+ summary: This Gem adds useful methods to your Rails app to validate, display and save phone numbers.
119
+ test_files:
114
120
  - spec/lib/phony_rails_spec.rb
115
121
  - spec/lib/validators/phony_validator_spec.rb
116
122
  - spec/spec_helper.rb
117
- has_rdoc: