useful_validators 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,20 @@
1
1
  # coding: utf-8
2
2
  module CustomEmailValidator
3
- def self.email_regex
4
- /\A#{email_name_regex}@#{domain_head_regex}#{domain_tld_regex}\z/i
5
- end
3
+ class << self
4
+ def email_regex
5
+ /\A#{email_name_regex}@#{domain_head_regex}#{domain_tld_regex}\z/i
6
+ end
6
7
 
7
- def self.email_name_regex
8
- '[\w\.%\+\-]+'.freeze
9
- end
8
+ def email_name_regex
9
+ '[\w\.%\+\-]+'.freeze
10
+ end
10
11
 
11
- def self.domain_head_regex
12
- '(?:[A-Z0-9\-]+\.)+'.freeze
13
- end
12
+ def domain_head_regex
13
+ '(?:[A-Z0-9\-]+\.)+'.freeze
14
+ end
14
15
 
15
- def self.domain_tld_regex
16
- '(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|jobs|museum)'.freeze
16
+ def domain_tld_regex
17
+ '(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|jobs|museum)'.freeze
18
+ end
17
19
  end
18
20
  end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ module CustomPhoneValidator
3
+ # https://github.com/sms2me/mobile_phone_formats
4
+ class << self
5
+ # World
6
+ def world_phone_regex
7
+ /\+?([87](?!95[4-79]|99[^2457]|907|94[^0]|336|986)([348]\d|9[0-689]|7[0247])\d{8}|[1246]\d{9,13}|68\d{7}|5[1-46-9]\d{8,12}|55[1-9]\d{9}|55119\d{8}|500[56]\d{4}|5016\d{6}|5068\d{7}|502[45]\d{7}|5037\d{7}|50[457]\d{8}|50855\d{4}|509[34]\d{7}|376\d{6}|855\d{8}|856\d{10}|85[0-4789]\d{8,10}|8[68]\d{10,11}|8[14]\d{10}|82\d{9,10}|852\d{8}|90\d{10}|96(0[79]|17[01]|13)\d{6}|96[23]\d{9}|964\d{10}|96(5[69]|89)\d{7}|96(65|77)\d{8}|92[023]\d{9}|91[1879]\d{9}|9[34]7\d{8}|959\d{7}|989\d{9}|97\d{8,12}|99[^4568]\d{7,11}|994\d{9}|9955\d{8}|996[57]\d{8}|9989\d{8}|380[34569]\d{8}|381\d{9}|385\d{8,9}|375[234]\d{8}|372\d{7,8}|37[0-4]\d{8}|37[6-9]\d{7,11}|30[69]\d{9}|34[67]\d{8}|3[12359]\d{8,12}|36\d{9}|38[1679]\d{8}|382\d{8,9})/
8
+ end
9
+
10
+ # Sng
11
+ def sng_phone_regex
12
+ /((\+?7|8)(?!95[4-79]|99[^2457]|907|94[^0]|336)([348]\d|9[0-689]|7[07])\d{8}|\+?(99[^456]\d{7,11}|994\d{9}|9955\d{8}|996[57]\d{8}|380[34569]\d{8}|375[234]\d{8}|372\d{7,8}|37[0-4]\d{8}))/
13
+ end
14
+
15
+ # Russia
16
+ def russian_phone_regex
17
+ /(79|73|74|78)[0-9]{9}/
18
+ end
19
+
20
+ # Ukrain
21
+ def ukrainian_phone_regex
22
+ /\+?380/
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module UsefulValidators
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: useful_validators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-25 00:00:00.000000000 Z
12
+ date: 2013-07-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: useful_validators
15
15
  email:
@@ -25,6 +25,7 @@ files:
25
25
  - Rakefile
26
26
  - lib/useful_validators.rb
27
27
  - lib/useful_validators/custom_email_validator.rb
28
+ - lib/useful_validators/custom_phone_validator.rb
28
29
  - lib/useful_validators/version.rb
29
30
  - useful_validators.gemspec
30
31
  homepage: https://github.com/vav/useful_validators.git