rails-validator 0.0.1
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 +7 -0
- data/lib/rails-validator.rb +13 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ece2d9568ad09b030a83cecad5ad8d46ae63215d45ee885efc2d9f33b7246de1
|
4
|
+
data.tar.gz: 2699178694fc26bce0c58f3055ed6ab53086ecd4dd636001fff07953332000b7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4e5d83aed3f89dfeb6db595eb3a80d68fe70fadd5796bcbbf4a709641e462af6cf9e832bb48502813de787b0a9f92fdaa04bc26bd1832024c2c9c16aab042118
|
7
|
+
data.tar.gz: 3e7bb84f4a329f171fd6806a127e8be5feb0b432024ed59b6db528bc99da3b2f426354ee3038f584a648eabba426cf3fccd7ef7517f7205138898fe6bd01a7bb
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class RailsValidator
|
2
|
+
def self.validate_file(file)
|
3
|
+
return File.extname(file).match?(/doc/)
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.validate_email(email)
|
7
|
+
return email.match?(/\A(?:[a-z0-9!$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])\z/)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.validate_password(password)
|
11
|
+
return password.match?(/\A(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\W]).{8,}\z/)
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-validator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Evan Masterson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: ''
|
14
|
+
email: evanm95@hotmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/rails-validator.rb
|
20
|
+
homepage: http://rubygems.org/gems/rails-validator
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata:
|
24
|
+
source_code_uri: https://github.com/evanmasterson/rails-validator
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubyforge_project:
|
41
|
+
rubygems_version: 2.7.7
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Validate inputs (Files/Email/Passwords)
|
45
|
+
test_files: []
|