attr_validator 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.travis.yml +4 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +37 -0
- data/LICENSE.txt +22 -0
- data/README.md +119 -0
- data/Rakefile +1 -0
- data/attr_validator.gemspec +24 -0
- data/lib/attr_validator/args_validator.rb +118 -0
- data/lib/attr_validator/concern.rb +136 -0
- data/lib/attr_validator/core_extensions/class_attribute.rb +143 -0
- data/lib/attr_validator/errors.rb +23 -0
- data/lib/attr_validator/i18n.rb +7 -0
- data/lib/attr_validator/locales/en.yml +23 -0
- data/lib/attr_validator/validation_errors.rb +245 -0
- data/lib/attr_validator/validator.rb +148 -0
- data/lib/attr_validator/validators/email_validator.rb +48 -0
- data/lib/attr_validator/validators/exclusion_validator.rb +23 -0
- data/lib/attr_validator/validators/inclusion_validator.rb +28 -0
- data/lib/attr_validator/validators/length_validator.rb +32 -0
- data/lib/attr_validator/validators/not_nil_validator.rb +25 -0
- data/lib/attr_validator/validators/numericality_validator.rb +39 -0
- data/lib/attr_validator/validators/presence_validator.rb +26 -0
- data/lib/attr_validator/validators/regexp_validator.rb +21 -0
- data/lib/attr_validator/validators/url_validator.rb +25 -0
- data/lib/attr_validator/validators.rb +11 -0
- data/lib/attr_validator/version.rb +3 -0
- data/lib/attr_validator.rb +41 -0
- data/spec/attr_validator/validator_spec.rb +105 -0
- data/spec/attr_validator/validators/email_validator_spec.rb +24 -0
- data/spec/attr_validator/validators/exclusion_validator_spec.rb +24 -0
- data/spec/attr_validator/validators/inclusion_validator_spec.rb +24 -0
- data/spec/attr_validator/validators/length_validator_spec.rb +39 -0
- data/spec/attr_validator/validators/not_nil_validator_spec.rb +25 -0
- data/spec/attr_validator/validators/numericality_validator_spec.rb +50 -0
- data/spec/attr_validator/validators/presence_validator_spec.rb +25 -0
- data/spec/attr_validator/validators/regexp_validator_spec.rb +24 -0
- data/spec/attr_validator/validators/url_validator_spec.rb +24 -0
- data/spec/spec_helper.rb +7 -0
- metadata +145 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'i18n'
|
2
|
+
require 'attr_validator/core_extensions/class_attribute'
|
3
|
+
require 'attr_validator/concern'
|
4
|
+
require 'attr_validator/version'
|
5
|
+
require 'attr_validator/errors'
|
6
|
+
require 'attr_validator/args_validator'
|
7
|
+
require 'attr_validator/validator'
|
8
|
+
require 'attr_validator/i18n'
|
9
|
+
require 'attr_validator/validators'
|
10
|
+
require 'attr_validator/validation_errors'
|
11
|
+
|
12
|
+
module AttrValidator
|
13
|
+
@@validators = {}
|
14
|
+
|
15
|
+
# Returns list of defined validators
|
16
|
+
def self.validators
|
17
|
+
@@validators
|
18
|
+
end
|
19
|
+
|
20
|
+
# Adds new validator to AttrValidator
|
21
|
+
# @param validator_name [Symbol] validator name
|
22
|
+
# @param validator [.validate, .validation_options] validator
|
23
|
+
def self.add_validator(validator_name, validator)
|
24
|
+
@@validators[validator_name] = validator
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
AttrValidator.add_validator(:email, AttrValidator::Validators::EmailValidator)
|
29
|
+
AttrValidator.add_validator(:exclusion, AttrValidator::Validators::ExclusionValidator)
|
30
|
+
AttrValidator.add_validator(:inclusion, AttrValidator::Validators::InclusionValidator)
|
31
|
+
AttrValidator.add_validator(:length, AttrValidator::Validators::LengthValidator)
|
32
|
+
AttrValidator.add_validator(:numericality, AttrValidator::Validators::NumericalityValidator)
|
33
|
+
AttrValidator.add_validator(:presence, AttrValidator::Validators::PresenceValidator)
|
34
|
+
AttrValidator.add_validator(:not_blank, AttrValidator::Validators::PresenceValidator)
|
35
|
+
AttrValidator.add_validator(:not_nil, AttrValidator::Validators::NotNilValidator)
|
36
|
+
AttrValidator.add_validator(:regexp, AttrValidator::Validators::RegexpValidator)
|
37
|
+
AttrValidator.add_validator(:url, AttrValidator::Validators::UrlValidator)
|
38
|
+
|
39
|
+
# I18n settings
|
40
|
+
I18n.load_path = Dir['lib/attr_validator/locales/*.yml']
|
41
|
+
I18n.default_locale = :en
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'attr_validator'
|
3
|
+
|
4
|
+
describe AttrValidator::Validator do
|
5
|
+
describe "#validate" do
|
6
|
+
class Contact
|
7
|
+
attr_accessor :first_name, :last_name, :position, :age, :type, :email, :color, :status, :stage, :description, :companies
|
8
|
+
end
|
9
|
+
class Company
|
10
|
+
attr_accessor :name
|
11
|
+
end
|
12
|
+
|
13
|
+
class CompanyValidator
|
14
|
+
include AttrValidator::Validator
|
15
|
+
|
16
|
+
validates :name, presence: true, length: { min: 3, max: 9 }
|
17
|
+
end
|
18
|
+
|
19
|
+
class ContactValidator
|
20
|
+
include AttrValidator::Validator
|
21
|
+
|
22
|
+
validates :first_name, presence: true, length: { min: 4, max: 7 }
|
23
|
+
validates :last_name, length: { equal_to: 5 }
|
24
|
+
validates :position, length: { not_equal_to: 5 }
|
25
|
+
validates :age, numericality: { greater_than: 0, less_than: 150 }
|
26
|
+
validates :type, numericality: { greater_than_or_equal_to: 1, less_than_or_equal_to: 5 }
|
27
|
+
validates :email, email: true
|
28
|
+
validates :color, regexp: /#\w{6}/
|
29
|
+
validates :status, inclusion: { in: [:new, :lead] }
|
30
|
+
validates :stage, exclusion: { in: [:wrong, :bad] }
|
31
|
+
|
32
|
+
validate_associated :companies, validator: CompanyValidator
|
33
|
+
|
34
|
+
validate :check_description
|
35
|
+
|
36
|
+
def check_description(entity, errors)
|
37
|
+
if entity.description.nil?
|
38
|
+
errors.add(:description, "can't be empty")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should return empty errors if object is valid" do
|
44
|
+
contact = Contact.new
|
45
|
+
contact.first_name = "John"
|
46
|
+
contact.last_name = "Smith"
|
47
|
+
contact.position = "Team Lead"
|
48
|
+
contact.age = 35
|
49
|
+
contact.type = 2
|
50
|
+
contact.email = "johh.smith@example.com"
|
51
|
+
contact.color = "#DDD333"
|
52
|
+
contact.status = :lead
|
53
|
+
contact.stage = :good
|
54
|
+
contact.description = "good guy"
|
55
|
+
|
56
|
+
company1 = Company.new
|
57
|
+
company1.name = 'DroidLabs'
|
58
|
+
company2 = Company.new
|
59
|
+
company2.name = 'ICL'
|
60
|
+
|
61
|
+
contact.companies = [company1, company2]
|
62
|
+
|
63
|
+
errors = ContactValidator.new.validate(contact)
|
64
|
+
errors.should be_empty
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should return validation errors if object is invalid" do
|
68
|
+
contact = Contact.new
|
69
|
+
contact.first_name = nil
|
70
|
+
contact.last_name = "Sm"
|
71
|
+
contact.position = "develp"
|
72
|
+
contact.age = -1
|
73
|
+
contact.type = 7
|
74
|
+
contact.email = "johh.com"
|
75
|
+
contact.color = "DDD333"
|
76
|
+
contact.status = :left
|
77
|
+
contact.stage = :bad
|
78
|
+
|
79
|
+
company1 = Company.new
|
80
|
+
company1.name = 'DroidLabs Wrong'
|
81
|
+
company2 = Company.new
|
82
|
+
company2.name = 'IC'
|
83
|
+
|
84
|
+
contact.companies = [company1, company2]
|
85
|
+
|
86
|
+
errors = ContactValidator.new.validate(contact)
|
87
|
+
errors.should == {
|
88
|
+
first_name: ["can not be blank"],
|
89
|
+
last_name: ["should be equal to 5"],
|
90
|
+
age: ["should be greater than 0"],
|
91
|
+
type: ["should be less than or equal to 5"],
|
92
|
+
email: ["invalid email"],
|
93
|
+
color: ["does not match defined format"],
|
94
|
+
status: ["should be included in [:new, :lead]"],
|
95
|
+
stage: ["should not be included in [:wrong, :bad]"],
|
96
|
+
description: ["can't be empty"],
|
97
|
+
companies_errors: [
|
98
|
+
{ name: ["can not be more than 9"] },
|
99
|
+
{ name: ["can not be less than 3"] },
|
100
|
+
]
|
101
|
+
}
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'attr_validator'
|
3
|
+
|
4
|
+
describe AttrValidator::Validators::EmailValidator do
|
5
|
+
describe ".validate" do
|
6
|
+
it "should return empty errors if email is valid" do
|
7
|
+
errors = AttrValidator::Validators::EmailValidator.validate('test@example.com', true)
|
8
|
+
errors.should be_empty
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return errors if value is invalid" do
|
12
|
+
errors = AttrValidator::Validators::EmailValidator.validate('test@asdffd', true)
|
13
|
+
errors.should == ["invalid email"]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe ".validate_options" do
|
18
|
+
it "should raise error if validation attributes are invalid" do
|
19
|
+
lambda do
|
20
|
+
AttrValidator::Validators::EmailValidator.validate_options("asdf")
|
21
|
+
end.should raise_error("validation_rule should be a Boolean")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'attr_validator'
|
3
|
+
|
4
|
+
describe AttrValidator::Validators::ExclusionValidator do
|
5
|
+
describe ".validate" do
|
6
|
+
it "should return empty errors if value is valid" do
|
7
|
+
errors = AttrValidator::Validators::ExclusionValidator.validate(:wrong_type, in: [:new, :old, :medium])
|
8
|
+
errors.should be_empty
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return errors if value is invalid" do
|
12
|
+
errors = AttrValidator::Validators::ExclusionValidator.validate(:new, in: [:new, :old, :medium])
|
13
|
+
errors.should == ["should not be included in [:new, :old, :medium]"]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe ".validate_options" do
|
18
|
+
it "should raise error if validation attributes are invalid" do
|
19
|
+
lambda do
|
20
|
+
AttrValidator::Validators::ExclusionValidator.validate_options(wrong_option: false)
|
21
|
+
end.should raise_error("validation_rule has unacceptable options [:wrong_option]")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'attr_validator'
|
3
|
+
|
4
|
+
describe AttrValidator::Validators::InclusionValidator do
|
5
|
+
describe ".validate" do
|
6
|
+
it "should return empty errors if value is valid" do
|
7
|
+
errors = AttrValidator::Validators::InclusionValidator.validate(:old, in: [:new, :old, :medium])
|
8
|
+
errors.should be_empty
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return errors if value is invalid" do
|
12
|
+
errors = AttrValidator::Validators::InclusionValidator.validate(:wrong_type, in: [:new, :old, :medium])
|
13
|
+
errors.should == ["should be included in [:new, :old, :medium]"]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe ".validate_options" do
|
18
|
+
it "should raise error if validation attributes are invalid" do
|
19
|
+
lambda do
|
20
|
+
AttrValidator::Validators::InclusionValidator.validate_options(wrong_option: false)
|
21
|
+
end.should raise_error("validation options has unacceptable options [:wrong_option]")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'attr_validator'
|
3
|
+
|
4
|
+
describe AttrValidator::Validators::LengthValidator do
|
5
|
+
describe ".validate" do
|
6
|
+
it "should return empty errors if text has valid length" do
|
7
|
+
errors = AttrValidator::Validators::LengthValidator.validate('home', max: 5, min: 3)
|
8
|
+
errors.should be_empty
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return errors if value has invalid max length" do
|
12
|
+
errors = AttrValidator::Validators::LengthValidator.validate('long title', max: 5)
|
13
|
+
errors.should == ["can not be more than 5"]
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return errors if value has invalid min length" do
|
17
|
+
errors = AttrValidator::Validators::LengthValidator.validate('ya', min: 3)
|
18
|
+
errors.should == ["can not be less than 3"]
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return errors if value has invalid equal_to length" do
|
22
|
+
errors = AttrValidator::Validators::LengthValidator.validate('ya', equal_to: 3)
|
23
|
+
errors.should == ["should be equal to 3"]
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should return errors if value has invalid not_equal_to length" do
|
27
|
+
errors = AttrValidator::Validators::LengthValidator.validate('yad', not_equal_to: 3)
|
28
|
+
errors.should == ["should not be equal to 3"]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe ".validate_options" do
|
33
|
+
it "should raise error if validation attributes are invalid" do
|
34
|
+
lambda do
|
35
|
+
AttrValidator::Validators::LengthValidator.validate_options(max: 5, wrong_attr: 3)
|
36
|
+
end.should raise_error("validation_rule has unacceptable options [:wrong_attr]")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'attr_validator'
|
3
|
+
|
4
|
+
describe AttrValidator::Validators::NotNilValidator do
|
5
|
+
describe ".validate" do
|
6
|
+
it "should return empty errors if object is not nil" do
|
7
|
+
errors = AttrValidator::Validators::NotNilValidator.validate('home', true)
|
8
|
+
errors.should be_empty
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return errors if object is nil" do
|
12
|
+
errors = AttrValidator::Validators::NotNilValidator.validate(nil, true)
|
13
|
+
errors.should == ["can not be nil"]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe ".validate_options" do
|
18
|
+
it "should raise error if validation attributes are invalid" do
|
19
|
+
lambda do
|
20
|
+
AttrValidator::Validators::NotNilValidator.validate_options("asdf")
|
21
|
+
end.should raise_error("validation_rule should be a Boolean")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'attr_validator'
|
3
|
+
|
4
|
+
describe AttrValidator::Validators::NumericalityValidator do
|
5
|
+
describe ".validate" do
|
6
|
+
it "should return empty errors if number is valid" do
|
7
|
+
errors = AttrValidator::Validators::NumericalityValidator.validate(4, less_than: 5, greater_than: 3)
|
8
|
+
errors.should be_empty
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return errors if value is less than needed" do
|
12
|
+
errors = AttrValidator::Validators::NumericalityValidator.validate(5, greater_than: 5)
|
13
|
+
errors.should == ["should be greater than 5"]
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return errors if value is less than or equal to what needed" do
|
17
|
+
errors = AttrValidator::Validators::NumericalityValidator.validate(4, greater_than_or_equal_to: 5)
|
18
|
+
errors.should == ["should be greater than or equal to 5"]
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return errors if value is greater than needed" do
|
22
|
+
errors = AttrValidator::Validators::NumericalityValidator.validate(5, less_than: 5)
|
23
|
+
errors.should == ["should be less than 5"]
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should return errors if value is greater than or equal to what needed" do
|
27
|
+
errors = AttrValidator::Validators::NumericalityValidator.validate(6, less_than_or_equal_to: 5)
|
28
|
+
errors.should == ["should be less than or equal to 5"]
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should return errors if value is not even" do
|
32
|
+
errors = AttrValidator::Validators::NumericalityValidator.validate(7, even: true)
|
33
|
+
errors.should == ["should be even number"]
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return errors if value is not odd" do
|
37
|
+
errors = AttrValidator::Validators::NumericalityValidator.validate(6, odd: true)
|
38
|
+
errors.should == ["should be odd number"]
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
describe ".validate_options" do
|
44
|
+
it "should raise error if validation attributes are invalid" do
|
45
|
+
lambda do
|
46
|
+
AttrValidator::Validators::NumericalityValidator.validate_options(less_than: 5, wrong_attr: 3)
|
47
|
+
end.should raise_error("validation_rule has unacceptable options [:wrong_attr]")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'attr_validator'
|
3
|
+
|
4
|
+
describe AttrValidator::Validators::PresenceValidator do
|
5
|
+
describe ".validate" do
|
6
|
+
it "should return empty errors if text is not blank" do
|
7
|
+
errors = AttrValidator::Validators::PresenceValidator.validate('home', true)
|
8
|
+
errors.should be_empty
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return errors if text is not specified" do
|
12
|
+
errors = AttrValidator::Validators::PresenceValidator.validate(" ", true)
|
13
|
+
errors.should == ["can not be blank"]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe ".validate_options" do
|
18
|
+
it "should raise error if validation attributes are invalid" do
|
19
|
+
lambda do
|
20
|
+
AttrValidator::Validators::PresenceValidator.validate_options("asdf")
|
21
|
+
end.should raise_error("validation_rule should be a Boolean")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'attr_validator'
|
3
|
+
|
4
|
+
describe AttrValidator::Validators::RegexpValidator do
|
5
|
+
describe ".validate" do
|
6
|
+
it "should return empty errors if value is valid" do
|
7
|
+
errors = AttrValidator::Validators::RegexpValidator.validate('#aaa', /#\w{3,6}/)
|
8
|
+
errors.should be_empty
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return errors if value is invalid" do
|
12
|
+
errors = AttrValidator::Validators::RegexpValidator.validate('asdf', /#\w{3,6}/)
|
13
|
+
errors.should == ["does not match defined format"]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe ".validate_options" do
|
18
|
+
it "should raise error if validation attributes are invalid" do
|
19
|
+
lambda do
|
20
|
+
AttrValidator::Validators::RegexpValidator.validate_options({})
|
21
|
+
end.should raise_error("validation_rule should be a String or Regexp")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'attr_validator'
|
3
|
+
|
4
|
+
describe AttrValidator::Validators::UrlValidator do
|
5
|
+
describe ".validate" do
|
6
|
+
it "should return empty errors if email is valid" do
|
7
|
+
errors = AttrValidator::Validators::UrlValidator.validate('example.com', true)
|
8
|
+
errors.should be_empty
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return errors if value is invalid" do
|
12
|
+
errors = AttrValidator::Validators::UrlValidator.validate(':123asdffd.com', true)
|
13
|
+
errors.should == ["invalid url"]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe ".validate_options" do
|
18
|
+
it "should raise error if validation attributes are invalid" do
|
19
|
+
lambda do
|
20
|
+
AttrValidator::Validators::UrlValidator.validate_options("asdf")
|
21
|
+
end.should raise_error("validation_rule should be a Boolean")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: attr_validator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Albert Gazizov
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-02-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
none: false
|
21
|
+
name: i18n
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
requirement: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ! '>='
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
none: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ~>
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '1.3'
|
36
|
+
none: false
|
37
|
+
name: bundler
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '1.3'
|
45
|
+
none: false
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
none: false
|
53
|
+
name: rake
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
none: false
|
62
|
+
description: Object validation library
|
63
|
+
email:
|
64
|
+
- deeper4k@gmail.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- .travis.yml
|
71
|
+
- Gemfile
|
72
|
+
- Gemfile.lock
|
73
|
+
- LICENSE.txt
|
74
|
+
- README.md
|
75
|
+
- Rakefile
|
76
|
+
- attr_validator.gemspec
|
77
|
+
- lib/attr_validator.rb
|
78
|
+
- lib/attr_validator/args_validator.rb
|
79
|
+
- lib/attr_validator/concern.rb
|
80
|
+
- lib/attr_validator/core_extensions/class_attribute.rb
|
81
|
+
- lib/attr_validator/errors.rb
|
82
|
+
- lib/attr_validator/i18n.rb
|
83
|
+
- lib/attr_validator/locales/en.yml
|
84
|
+
- lib/attr_validator/validation_errors.rb
|
85
|
+
- lib/attr_validator/validator.rb
|
86
|
+
- lib/attr_validator/validators.rb
|
87
|
+
- lib/attr_validator/validators/email_validator.rb
|
88
|
+
- lib/attr_validator/validators/exclusion_validator.rb
|
89
|
+
- lib/attr_validator/validators/inclusion_validator.rb
|
90
|
+
- lib/attr_validator/validators/length_validator.rb
|
91
|
+
- lib/attr_validator/validators/not_nil_validator.rb
|
92
|
+
- lib/attr_validator/validators/numericality_validator.rb
|
93
|
+
- lib/attr_validator/validators/presence_validator.rb
|
94
|
+
- lib/attr_validator/validators/regexp_validator.rb
|
95
|
+
- lib/attr_validator/validators/url_validator.rb
|
96
|
+
- lib/attr_validator/version.rb
|
97
|
+
- spec/attr_validator/validator_spec.rb
|
98
|
+
- spec/attr_validator/validators/email_validator_spec.rb
|
99
|
+
- spec/attr_validator/validators/exclusion_validator_spec.rb
|
100
|
+
- spec/attr_validator/validators/inclusion_validator_spec.rb
|
101
|
+
- spec/attr_validator/validators/length_validator_spec.rb
|
102
|
+
- spec/attr_validator/validators/not_nil_validator_spec.rb
|
103
|
+
- spec/attr_validator/validators/numericality_validator_spec.rb
|
104
|
+
- spec/attr_validator/validators/presence_validator_spec.rb
|
105
|
+
- spec/attr_validator/validators/regexp_validator_spec.rb
|
106
|
+
- spec/attr_validator/validators/url_validator_spec.rb
|
107
|
+
- spec/spec_helper.rb
|
108
|
+
homepage: http://github.com/AlbertGazizov/attr_validator
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
none: false
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
none: false
|
127
|
+
requirements: []
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 1.8.23
|
130
|
+
signing_key:
|
131
|
+
specification_version: 3
|
132
|
+
summary: Moves validation logic to validators
|
133
|
+
test_files:
|
134
|
+
- spec/attr_validator/validator_spec.rb
|
135
|
+
- spec/attr_validator/validators/email_validator_spec.rb
|
136
|
+
- spec/attr_validator/validators/exclusion_validator_spec.rb
|
137
|
+
- spec/attr_validator/validators/inclusion_validator_spec.rb
|
138
|
+
- spec/attr_validator/validators/length_validator_spec.rb
|
139
|
+
- spec/attr_validator/validators/not_nil_validator_spec.rb
|
140
|
+
- spec/attr_validator/validators/numericality_validator_spec.rb
|
141
|
+
- spec/attr_validator/validators/presence_validator_spec.rb
|
142
|
+
- spec/attr_validator/validators/regexp_validator_spec.rb
|
143
|
+
- spec/attr_validator/validators/url_validator_spec.rb
|
144
|
+
- spec/spec_helper.rb
|
145
|
+
has_rdoc:
|