is_valid 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/is_valid.rb +2 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8ada29e709715bb3de6761dec626dcebd7c675e36b305df1c8b4df206c396b8
4
- data.tar.gz: a4c9b90bffd43897a3d4de513f46174c4e06d402b54ee9a118805e8091aed549
3
+ metadata.gz: 6a630e0455a4889ed70aa01d3fda7d1295a44670992d6a2fe0e38376f97db86c
4
+ data.tar.gz: f57d9b9b9b48a7e8249f0729c60892ee7892eba630cfc118a9cf9c197f45a833
5
5
  SHA512:
6
- metadata.gz: b436bde4d832239111cd8ac7f822ddbc995df4daedbf5447c12dc5401ed5cb4bd89a6f6f55e222fdc190ca4cf6b7b5a7ac88b903c5c8f66f27c5b26370ac0dd1
7
- data.tar.gz: 5728d261e3d6957f3c35cbd579fed8bee8a8e77fffcf5f95f2f3ce1e7d6585e24fa10334786a49e308de58bfd839f95245c6a0e062af1a3998736117a1bf47db
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.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-09 00:00:00.000000000 Z
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