validy 1.1.5.1 → 1.1.5.2
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/lib/validy.rb +4 -2
- 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: 8469d3a208d0f04205302c18b3c3b4896cefdf59beff7f30370979bf4fb6c1c0
|
4
|
+
data.tar.gz: 1c246fc93a1907d520bf6a2d45383c188349015b6f035a76ed588194353907e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd5283866a080ab683297dc58f6eadc091da7faae805ab15156f23e1e56d0864e598b6deb132b23689281f47c1393f2dcfc5bfaae0a4833ee2287b8d0213d702
|
7
|
+
data.tar.gz: 5d18a0a06bea3b99a6c0c74242c05f202b3c47ec0cfefda219ae018575e4b0e1555c24737190ad3af8702384ccc10a7e1d019c5af54dbf66fd2f44b530a5123c
|
data/lib/validy.rb
CHANGED
@@ -143,7 +143,9 @@ module Validy
|
|
143
143
|
return self unless valid?
|
144
144
|
|
145
145
|
@evaluating_attribute_value = instance_variable_get("@#{attribute}")
|
146
|
-
|
146
|
+
unless @evaluating_attribute_value.instance_of?(FalseClass)
|
147
|
+
validate_condition(@evaluating_attribute_value, error || "#{attribute} required!", &block)
|
148
|
+
end
|
147
149
|
self
|
148
150
|
end
|
149
151
|
|
@@ -196,7 +198,7 @@ module Validy
|
|
196
198
|
end
|
197
199
|
|
198
200
|
def validate_condition(condition, error = nil, &block)
|
199
|
-
return if condition
|
201
|
+
return if condition
|
200
202
|
|
201
203
|
error_hash = error_hash error
|
202
204
|
add_error error_hash
|