is_valid 0.1.1 → 0.1.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.
Potentially problematic release.
This version of is_valid might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/is_valid.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a630e0455a4889ed70aa01d3fda7d1295a44670992d6a2fe0e38376f97db86c
|
4
|
+
data.tar.gz: f57d9b9b9b48a7e8249f0729c60892ee7892eba630cfc118a9cf9c197f45a833
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 865393e3653a9e33504cc7d3692113e17b50fc0322ad6b991c8b1c22fad52f890260f888fbce59a585d74432cefcfa037e3566670ae797dec87e615b528e297f
|
7
|
+
data.tar.gz: 39ed0674d51b919649728f74abb025c04bf6e4ef906d3cfa6428500345683fefeef4eff5ee6831e7516cdaa30b5557e7028b859e09d5097662224c1839e608f3
|
data/lib/is_valid.rb
CHANGED
@@ -13,6 +13,7 @@ class IsValid
|
|
13
13
|
url: '^(http://|https://)(.)+\.(.)+$',
|
14
14
|
email: '^([a-z,A-Z,\-,\_,\.]*)@(.*)+\.(.*)$',
|
15
15
|
any: '(.*)+',
|
16
|
+
string: '(.*)+',
|
16
17
|
nil: nil
|
17
18
|
}
|
18
19
|
@rules = @rules.merge(rules)
|
@@ -33,7 +34,7 @@ class IsValid
|
|
33
34
|
rules = @templates[template.to_sym]
|
34
35
|
if !rules.nil?
|
35
36
|
hash_var.each do |key, val|
|
36
|
-
errors << "#{key} is not valid, should be #{rules[key.to_sym]}" unless check(val, rules[key.to_sym])
|
37
|
+
errors << "#{key} is not valid, should be #{rules[key.to_sym]}" unless !rules[key.to_sym].nil? && check(val, rules[key.to_sym])
|
37
38
|
end
|
38
39
|
else
|
39
40
|
p 'template with rules does not exist'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: is_valid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergei Illarionov (www.butteff.ru/en/)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby Gem to make a validation of a variable or a hash, based on regular
|
14
14
|
expressions or own predefined validation templates in an easy way. See full documentation
|