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.
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: 6a48896ad47a8340f69ce05f39bda359eb90fa8ac06565ee0ffc56e491b6e394
4
- data.tar.gz: a5b2bbb2c5445e22aca14abdcb1fe306e64c8315114438a43542116307d8fb3a
3
+ metadata.gz: 032d77e1a14f13ad4103d6f00c3897d78938c550a12cb01f2dd005f87a3cdb7f
4
+ data.tar.gz: d5f557d406a222d5de8539d018335f9292b902ddba50a6fb76ef713e76dcc22e
5
5
  SHA512:
6
- metadata.gz: 8fb3ebe4d72d76347ebd504017dac167a0d5b229b791ba1ceae4044d56db16ba32077b3d3a1e687d14056c24d5dc9cfcad59189908c9d1ae46fcad39c74988a2
7
- data.tar.gz: 736a38e99f7a276e391eed539fc6d3342f6b955e029369f26450696ea8d005ed3fd040a8bd33faf42f4d17848e9971194e4e7a6ec3ed710f7ad679f0dbf9a2c6
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[-1]
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.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergei Illarionov (www.butteff.ru/en/)