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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0275909ca21c9d7ca68e5ddd3c3a87328dac08b3
4
- data.tar.gz: 1e6cdcbde80eae48decdc5f373c9aee63babc616
3
+ metadata.gz: b40746f0fd7043c303b120ac984c68029f5586da
4
+ data.tar.gz: 5856476d02e38656a40f3deefb6a4bf981ea338d
5
5
  SHA512:
6
- metadata.gz: e93c17ecfb23870712958b06a6aae44df5e9ee743065829de1b9b1bc14cdccd34df2a1624a907b2b6d64db77f26de62f555197503be0954e36e9db89a125c3ad
7
- data.tar.gz: 47217daa47a72efe20c2522e2cc726eaedd74ab7896b6f38252bda208a2ebaeefe785e828c41b268d124ed1598b07e0603bdc94412469c3f4ff5b26545ebf1df
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
@@ -1,5 +1,5 @@
1
1
  module Drexed
2
2
  module Validators
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  require "drexed/validators/version"
2
- require "drexed/email"
3
- require "drexed/url"
2
+ require 'active_model/validations/email_validator'
3
+ require 'active_model/validations/url_validator'
4
4
 
5
5
  module Drexed
6
6
  module Validators
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.5
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/drexed/email_validator.rb
55
- - lib/drexed/url_validator.rb
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
@@ -1,9 +0,0 @@
1
- require 'active_model'
2
-
3
- class UrlValidator < ActiveModel::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