ig-validator-utils 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/lib/ig-validator-utils.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23b14c40b525eac2de3cea77fab6da2a6f08ee90
|
4
|
+
data.tar.gz: d68793f899d7ef2ac7d96d5ef7643a9fde439020
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0260326b29ab8c20b27835887f9a48fd4b8e4441d67997800f5bf1d0d8447d0516c2d3edc1e098e587b1b3922201756da9d05562d9f844332402bfb202bacf2b
|
7
|
+
data.tar.gz: 4348eeb8e6edda5959fc4241066ec675747c3c16fda802785f74efd3fad6de63e1f79de310c45de067ec6d2840c61f734f038851b58a0745392cd3ab3a9fa00a
|
data/lib/ig-validator-utils.rb
CHANGED
@@ -19,7 +19,7 @@ module ValidatorUtils
|
|
19
19
|
|
20
20
|
def self.validate_integer(value)
|
21
21
|
Float(value) != nil rescue false
|
22
|
-
|
22
|
+
end
|
23
23
|
|
24
24
|
def self.validate_boolean(value)
|
25
25
|
!!value == value
|
@@ -71,11 +71,13 @@ module ValidatorUtils
|
|
71
71
|
|
72
72
|
def self.validate_email(value)
|
73
73
|
value =~ /^[\w+\-.]+@[a-z\d\-.]+\.[a-z]+$/
|
74
|
-
|
74
|
+
end
|
75
75
|
|
76
76
|
# accepts only numbers with international codes in the format +12 12345678
|
77
77
|
def self.validate_mobile(value)
|
78
|
-
|
78
|
+
# strip out spaces first
|
79
|
+
stripped = value.split.join
|
80
|
+
stripped =~ /^(\+\d{1,3}[-]?)\d{8,12}$/
|
79
81
|
end
|
80
82
|
end
|
81
83
|
end
|