is_valid 0.0.7 → 0.0.9

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 +7 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52d7f0c269773fca0004890f533913e50b3890e346fa61790e32b81999f3d8a6
4
- data.tar.gz: 4416eb822c8700d12e31c1df142bfaa36e556fdbc4470634d3ab2ac1970b4a33
3
+ metadata.gz: 032d77e1a14f13ad4103d6f00c3897d78938c550a12cb01f2dd005f87a3cdb7f
4
+ data.tar.gz: d5f557d406a222d5de8539d018335f9292b902ddba50a6fb76ef713e76dcc22e
5
5
  SHA512:
6
- metadata.gz: '0886da35af820bb8545b0a064f68e82fe6fc353cd471e771d4abb76f0095a305fa984754f89e367cf837ecd96a52e037f375a86a89f8a38614725c53281f2990'
7
- data.tar.gz: 3d80dcaf9873382298d3bdaf61addaa5a2d4cfedf711008e4ee6a90ad0eb6d2e27d00cc64d4572bee723178c0299dc53d828e54d3831b5d52b59e761c4031d76
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
- res = @rules[rule_name.to_sym].nil? ? var.nil? : var.to_s.match?(@rules[rule_name.to_sym])
21
- res = var.nil? if !res && rule_name.to_a.last == '*'
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: is_valid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergei Illarionov (www.butteff.ru/en/)