veto 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/README.md +3 -3
- data/lib/veto/attribute_validator_factory.rb +3 -3
- data/lib/veto/validator.rb +0 -2
- data/lib/veto/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 569cf65f25931b9a8ae0f2a357d7163c04195fa8
|
4
|
+
data.tar.gz: c95247aed3ff88dd2e413e5d48c05fa13b6fb63b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2159bc303f0dd6ba0fa69b3ba497abeec0981893e6b630bd235fe7378207588a22b3d65913fc98a9efd491b67182bd5c1eccedfa436816e3ef18137efec3bec3
|
7
|
+
data.tar.gz: 88f37e7ebc017a26b23dab4303ca28e8abd885286caa5fbc4c7f5f35bf30708c602ddaf39c65e4b8308d060a2e875ba5e8fbf29df93fbaa88e1de2fcedc652cb
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Veto provides lightweight validation for plain old ruby objects, using a familiar DSL.
|
4
4
|
|
5
|
-
Tested on the following Rubies: MRI 2.0.0.
|
5
|
+
Tested on the following Rubies: MRI 2.0.0, 1.9.3
|
6
6
|
|
7
7
|
[![Build Status](https://travis-ci.org/kodio/veto.png)](https://travis-ci.org/kodio/veto)
|
8
8
|
|
@@ -32,8 +32,8 @@ $ gem install veto
|
|
32
32
|
class PersonValidator
|
33
33
|
include Veto.validator
|
34
34
|
|
35
|
-
|
36
|
-
|
35
|
+
validates :name, :presence => true
|
36
|
+
validates :age, :inclusion => 0..100
|
37
37
|
end
|
38
38
|
|
39
39
|
# Create an entity
|
@@ -16,12 +16,12 @@ require 'veto/validators/presence_validator'
|
|
16
16
|
module Veto
|
17
17
|
class AttributeValidatorFactory
|
18
18
|
def self.new_validator type, attribute, options={}
|
19
|
-
klass_name = "
|
19
|
+
klass_name = "#{camel_case(type.to_s)}Validator"
|
20
20
|
|
21
21
|
begin
|
22
|
-
klass = const_get(klass_name)
|
22
|
+
klass = Veto.const_get(klass_name)
|
23
23
|
rescue NameError => e
|
24
|
-
raise(ArgumentError, "Validator not found:
|
24
|
+
raise(ArgumentError, "Validator not found: ::Veto::#{klass_name}")
|
25
25
|
end
|
26
26
|
|
27
27
|
klass.new(attribute, options)
|
data/lib/veto/validator.rb
CHANGED
data/lib/veto/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: veto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Lott
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -177,4 +177,3 @@ test_files:
|
|
177
177
|
- spec/validators/numeric_validator_spec.rb
|
178
178
|
- spec/validators/presence_validator_spec.rb
|
179
179
|
- spec/veto_spec.rb
|
180
|
-
has_rdoc:
|