is_valid 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/is_valid.rb +7 -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: 032d77e1a14f13ad4103d6f00c3897d78938c550a12cb01f2dd005f87a3cdb7f
|
4
|
+
data.tar.gz: d5f557d406a222d5de8539d018335f9292b902ddba50a6fb76ef713e76dcc22e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1e1b7cd6f7d6439436c427d42f398aa845a2ea3220b67c52956b714cf39748647d899f38b29e3484a841710b43e979feda56d80fcb2caa0d60be626e5722e3a
|
7
|
+
data.tar.gz: 6a601f0255b15fe7289ab09d1b771e75c269d39107dda6ef21626d5b26d380a944e5353433ed4b579b7e7f136d87cd32c7ec7ac12aff7a92e9301a9858d41e97
|
data/lib/is_valid.rb
CHANGED
@@ -17,8 +17,13 @@ class IsValid
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def check(var, rule_name)
|
20
|
-
|
21
|
-
|
20
|
+
if rule_name[-1] == '*'
|
21
|
+
rule_name = rule_name[0..-2]
|
22
|
+
res = var.nil?
|
23
|
+
end
|
24
|
+
if !res
|
25
|
+
res = @rules[rule_name.to_sym].nil? ? var.nil? : var.to_s.match?(@rules[rule_name.to_sym])
|
26
|
+
end
|
22
27
|
res
|
23
28
|
end
|
24
29
|
|