type_validator 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/type_validator.rb +9 -7
- data/lib/type_validator/by_array_of.rb +1 -1
- data/lib/type_validator/by_array_with.rb +1 -1
- data/lib/type_validator/by_kind_of.rb +1 -1
- data/lib/type_validator/by_klass.rb +1 -1
- data/lib/type_validator/by_respond_to.rb +1 -1
- data/lib/type_validator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96d8db1bdc2cb03f7eddc41fb66025b36557fc83014845868a847b118f521d14
|
4
|
+
data.tar.gz: f1d2f58f64b062855ccb490332064b7b9a0f82162b1e0246d48eaa534a305961
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f6812a3e4dda60eb1157b42aa5553b2b1b4edce6df26b261d85fecc27be4dbba1fd334dd9628a4a33a97f318ddbdffb48f9fd8ad35160b98087a3087a103661
|
7
|
+
data.tar.gz: 4cbd56e7a43b563f9482176e24060842386d58d59d893c918042fe4cbc0df1417b8cc88317176e0abecb6fcf7b8878975dc5a93962fb83d1f403e19b3a15a6e7
|
data/lib/type_validator.rb
CHANGED
@@ -16,13 +16,15 @@ class TypeValidator < ActiveModel::EachValidator
|
|
16
16
|
record.errors.add(attribute, error)
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
private
|
20
|
+
|
21
|
+
def fetch_strategy(options)
|
22
|
+
return ByKindOf if options.key?(:is_a) || options.key?(:kind_of)
|
23
|
+
return ByRespondTo if options.key?(:respond_to)
|
24
|
+
return ByKlass if options.key?(:klass)
|
25
|
+
return ByArrayOf if options.key?(:array_of)
|
26
|
+
return ByArrayWith if options.key?(:array_with)
|
27
|
+
end
|
26
28
|
end
|
27
29
|
|
28
30
|
require 'type_validator/version'
|