drexed-validators 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_model/validations/email_validator.rb +11 -0
- data/lib/active_model/validations/url_validator.rb +11 -0
- data/lib/drexed/validators/version.rb +1 -1
- data/lib/drexed/validators.rb +2 -2
- metadata +3 -3
- data/lib/drexed/email_validator.rb +0 -9
- data/lib/drexed/url_validator.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b40746f0fd7043c303b120ac984c68029f5586da
|
4
|
+
data.tar.gz: 5856476d02e38656a40f3deefb6a4bf981ea338d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb194eb1b9ddf99a276d470ef8ff893517999d7615e61edacba298a77300f1e48d524e055c024a05b2ab54e5f5e97d68e33b6211cda7671245a9322a8950203b
|
7
|
+
data.tar.gz: 25c03220f0308d2db4e5f1f7a99b73b4ecba0f9a31fe1f550ed6e8f12fe1b01cff660aa7e2832f1c2e5b41e841b71e1b0820e3d90a3900a353f0296602306565
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module ActiveModel
|
2
|
+
module Validations
|
3
|
+
class EmailValidator < EachValidator
|
4
|
+
def validate_each(object, attribute, value)
|
5
|
+
unless value =~ /\A[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}\z/i
|
6
|
+
object.errors[attribute] << (options[:message] || "is not formatted properly")
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module ActiveModel
|
2
|
+
module Validations
|
3
|
+
class UrlValidator < EachValidator
|
4
|
+
def validate_each(object, attribute, value)
|
5
|
+
unless value =~ /https?:\/\/[\S]+/i
|
6
|
+
object.errors[attribute] << (options[:message] || "is not formatted properly")
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/drexed/validators.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drexed-validators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
@@ -51,8 +51,8 @@ files:
|
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
53
|
- drexed-validators.gemspec
|
54
|
-
- lib/
|
55
|
-
- lib/
|
54
|
+
- lib/active_model/validations/email_validator.rb
|
55
|
+
- lib/active_model/validations/url_validator.rb
|
56
56
|
- lib/drexed/validators.rb
|
57
57
|
- lib/drexed/validators/version.rb
|
58
58
|
homepage: https://github.com/drexed/drexed-validators
|
@@ -1,9 +0,0 @@
|
|
1
|
-
require 'active_model'
|
2
|
-
|
3
|
-
class EmailValidator < ActiveModel::EachValidator
|
4
|
-
def validate_each(object, attribute, value)
|
5
|
-
unless value =~ /\A[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}\z/i
|
6
|
-
object.errors[attribute] << (options[:message] || "is not formatted properly")
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
data/lib/drexed/url_validator.rb
DELETED