validation_kit 1.0.5 → 2.0.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +150 -0
- data/LICENSE +21 -0
- data/README.md +200 -0
- data/lib/validation_kit/country_option.rb +35 -0
- data/lib/validation_kit/email_validator/email_validator.rb +26 -13
- data/lib/validation_kit/mixed_case_validator/config/locales/en.yml +4 -5
- data/lib/validation_kit/mixed_case_validator/config/locales/fr.yml +4 -5
- data/lib/validation_kit/mixed_case_validator/mixed_case_validator.rb +29 -28
- data/lib/validation_kit/phone_validator/phone_validator.rb +102 -80
- data/lib/validation_kit/postal_code_validator/postal_code_validator.rb +46 -47
- data/lib/validation_kit/version.rb +3 -1
- data/lib/validation_kit.rb +31 -6
- metadata +31 -20
- data/.gitignore +0 -4
- data/Gemfile +0 -4
- data/Rakefile +0 -1
- data/lib/validation_kit/email_validator/README +0 -32
- data/lib/validation_kit/mixed_case_validator/README +0 -59
- data/lib/validation_kit/phone_validator/README +0 -69
- data/lib/validation_kit/postal_code_validator/README +0 -44
- data/validation_kit.gemspec +0 -21
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
validates_as_phone
|
|
2
|
-
==================
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Strict validation module for phone numbers that supports classifications and
|
|
6
|
-
areas.
|
|
7
|
-
|
|
8
|
-
= General usage
|
|
9
|
-
|
|
10
|
-
== Installation
|
|
11
|
-
|
|
12
|
-
You can install the plugin the traditional way. Go to your application root
|
|
13
|
-
and do:
|
|
14
|
-
|
|
15
|
-
script/plugin install git://github.com/paulschreiber/validates_as_phone.git
|
|
16
|
-
|
|
17
|
-
== Validate your model attributes
|
|
18
|
-
|
|
19
|
-
Example:
|
|
20
|
-
|
|
21
|
-
There are three ways to specify the country:
|
|
22
|
-
(1) Pass the country name in as a string parameter (:country => "CA")
|
|
23
|
-
class Person < ActiveRecord::Base
|
|
24
|
-
validates_as_phone :phone, :country => "CA", :allow_blank => true, :set => true
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
(2) Create an attribute (country field) named foo in your object, and pass in a reference to foo:
|
|
28
|
-
|
|
29
|
-
class Person < ActiveRecord::Base
|
|
30
|
-
validates_as_phone :phone, :country => :foo
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
(3) Create an attribute named country it in your object, i.e. Person#country
|
|
34
|
-
i.e. country is the default name for your country field, and the validator tries that automatically
|
|
35
|
-
|
|
36
|
-
class Person < ActiveRecord::Base
|
|
37
|
-
validates_as_phone :phone
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
The :set parameter tells the validator to reformat the phone number (change punctuation and spacing) in to a standard format.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Supported countries are Canada (CA), the United States (US) and Australia (AU).
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
= License
|
|
47
|
-
|
|
48
|
-
Written by Kristina Lim (http://i-think.com.ph/kristina/)
|
|
49
|
-
|
|
50
|
-
Copyright (c) 2008 Syndeo Media
|
|
51
|
-
http://syndeomedia.com
|
|
52
|
-
|
|
53
|
-
US and Canada support added by Paul Schreiber (http://paulschreiber.com/)
|
|
54
|
-
Last modified 07 September 2010
|
|
55
|
-
Extension support added 17 November 2010
|
|
56
|
-
|
|
57
|
-
= Contributing
|
|
58
|
-
|
|
59
|
-
If you wish to contribute to the project, you may contact the author through:
|
|
60
|
-
|
|
61
|
-
'kristinasyndeomediacom'.insert(8, '@').insert(20, '.')
|
|
62
|
-
|
|
63
|
-
= Acknowledgements
|
|
64
|
-
|
|
65
|
-
This plugin is named after the validates_as_phone plugin of Jerrod Blavos
|
|
66
|
-
(http://code.google.com/p/validates-as-phone/). Admittedly, this plugin was
|
|
67
|
-
built over the latter, but as the purposes of this plugin is more complex than
|
|
68
|
-
that of the minimal one, practically all of the code has been written over by
|
|
69
|
-
now.
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
validates_as_postal_code
|
|
2
|
-
=====================
|
|
3
|
-
|
|
4
|
-
Strict validation module for postal and zip codes.
|
|
5
|
-
|
|
6
|
-
= General usage
|
|
7
|
-
|
|
8
|
-
== Installation
|
|
9
|
-
|
|
10
|
-
You can install the plugin the traditional way. Go to your application root
|
|
11
|
-
and do:
|
|
12
|
-
|
|
13
|
-
script/plugin install git://github.com/paulschreiber/validates_as_postal_code.git
|
|
14
|
-
|
|
15
|
-
== Validate your model attributes
|
|
16
|
-
|
|
17
|
-
Example:
|
|
18
|
-
|
|
19
|
-
There are three ways to specify the country:
|
|
20
|
-
(1) Pass the country name in as a string parameter (:country => "CA")
|
|
21
|
-
class Person < ActiveRecord::Base
|
|
22
|
-
validates_as_postal_code :postal_code, :country => "CA", :allow_blank => true
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
(2) Create an attribute (country field) named foo in your object, and pass in a reference to foo:
|
|
26
|
-
class Person < ActiveRecord::Base
|
|
27
|
-
validates_as_postal_code :postal_code, :country => :foo
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
(3) Create an attribute named country it in your object, i.e. Person#country
|
|
31
|
-
i.e. country is the default name for your country field, and the validator tries that automatically
|
|
32
|
-
|
|
33
|
-
class Person < ActiveRecord::Base
|
|
34
|
-
validates_as_postal_code :postal_code
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
The :set parameter tells the validator to reformat the postal_code number (change punctuation and spacing) in to a standard format.
|
|
38
|
-
|
|
39
|
-
Supported countries are Canada (CA), the United States (US), Australia (AU), New Zealand (NZ). :set only works for Canada and the US; it's ignored for other countries.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
= License
|
|
43
|
-
|
|
44
|
-
Copyright (c) 2010 Paul Schreiber, released under the MIT license
|
data/validation_kit.gemspec
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
-
require "validation_kit/version"
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |s|
|
|
6
|
-
s.name = "validation_kit"
|
|
7
|
-
s.version = ValidationKit::VERSION
|
|
8
|
-
s.authors = ["Wes Morgan", "Paul Schreiber"]
|
|
9
|
-
s.email = ["wes@turbovote.org", "paulschreiber@gmail.com"]
|
|
10
|
-
s.homepage = "https://github.com/turbovote/validation_kit"
|
|
11
|
-
s.summary = %q{Handy validations for Rails forms}
|
|
12
|
-
s.description = %q{A collection of various validators for Rails forms}
|
|
13
|
-
|
|
14
|
-
s.rubyforge_project = "validation_kit"
|
|
15
|
-
|
|
16
|
-
s.files = `git ls-files`.split("\n")
|
|
17
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
18
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
19
|
-
s.require_paths = ["lib"]
|
|
20
|
-
|
|
21
|
-
end
|