domain_name_format_validator 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +7 -0
- data/Developers.md +2 -2
- data/README.md +8 -0
- data/lib/domain_name_format_validator/settings.rb +2 -1
- data/lib/domain_name_format_validator/validator.rb +2 -0
- data/lib/domain_name_format_validator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc78203ab37d8eb235915dbe9309661776551d335ffbb36783078fd85be0877b
|
4
|
+
data.tar.gz: a5a12c1ea8575fd92731a639bbf62271a2329fab3c59f91a0130f2b08902463e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5a9b28fab7047dfe026f80c3f5df1ea925b07c5845d5e82f4053e2e95929d5854a53c18527c414506d661c6480a0f33988551c27c2d12a2365b697667547c5c
|
7
|
+
data.tar.gz: eef887147dab118aa9665d1857ad0e5314101e8de87be8944c2ee5bc5ffd1fa3551605f87651f4ac7a6b6ad05aa219899f36ed8b81b2793bf91370448711626f
|
data/Changelog.md
CHANGED
data/Developers.md
CHANGED
@@ -58,7 +58,7 @@ Creating the Gem
|
|
58
58
|
To create the gem file for this gem, run the following command from the top
|
59
59
|
level of the gem's directory tree:
|
60
60
|
|
61
|
-
$
|
61
|
+
$ rake build
|
62
62
|
|
63
63
|
Pushing to RubyGems
|
64
64
|
-------------------
|
@@ -66,5 +66,5 @@ Pushing to RubyGems
|
|
66
66
|
Obviously, you can only do this step if you've got the appropriate privileges
|
67
67
|
at RubyGems.org and everything is properly configured.
|
68
68
|
|
69
|
-
$
|
69
|
+
$ rake release
|
70
70
|
|
data/README.md
CHANGED
@@ -24,18 +24,26 @@ How It Works
|
|
24
24
|
|
25
25
|
To validate a domain name:
|
26
26
|
|
27
|
+
```ruby
|
28
|
+
require 'domain_name_format_validator'
|
29
|
+
|
27
30
|
if DomainNameFormatValidator.valid?("example.com")
|
28
31
|
# Do something
|
29
32
|
end
|
33
|
+
```
|
30
34
|
|
31
35
|
What about error messages? If a domain isn't valid, it's often desirable to
|
32
36
|
find out why the domain ewasn't valid. To do this, simply pass an array into
|
33
37
|
the "validate" message as the optional second argument.
|
34
38
|
|
39
|
+
```ruby
|
40
|
+
require 'domain_name_format_validator'
|
41
|
+
|
35
42
|
errs = DomainNameFormatValidator.errors("example.123")
|
36
43
|
unless errs.empty?
|
37
44
|
puts("Errors: #{errs.inspect}")
|
38
45
|
end
|
46
|
+
```
|
39
47
|
|
40
48
|
This generates the following output:
|
41
49
|
|
@@ -22,6 +22,7 @@ module DomainNameFormatValidator
|
|
22
22
|
min_level_size: "Minimum domain level limit of 2 not achieved",
|
23
23
|
top_numerical: "The top-level domain (TLD) cannot be numerical",
|
24
24
|
top_illegal_chars: "The top-level domain (TLD) must only contain a-z 0-9 and -",
|
25
|
-
zero_size: "Zero-length domain name"
|
25
|
+
zero_size: "Zero-length domain name",
|
26
|
+
not_a_string: "Domain must be a string"
|
26
27
|
}.freeze
|
27
28
|
end
|