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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a9628f250ac1c08caf5d289860d1fe37ba167425204c6912325f60fa5365bfc
4
- data.tar.gz: 22ca205ad10c88913b099fca6473a19f9bc63eb6784e2e2e696973459e345be4
3
+ metadata.gz: bc78203ab37d8eb235915dbe9309661776551d335ffbb36783078fd85be0877b
4
+ data.tar.gz: a5a12c1ea8575fd92731a639bbf62271a2329fab3c59f91a0130f2b08902463e
5
5
  SHA512:
6
- metadata.gz: ee8b081426b91af56f66ead0501d74fd7e50de07548ab8ce289acedc1cc880790232fdca93e12d2cbd039a6d8b1a427c6e47be1605f35e0b59f19071beb079f7
7
- data.tar.gz: 007c9db3ae2e32c2948e0ae4b550f660722722ba2347eeb40188134c5afc1d17e2f67245cd3e1c3682e9d59d7ceb19753d6bf86bcf58bd98aecea2c94fa788b1
6
+ metadata.gz: b5a9b28fab7047dfe026f80c3f5df1ea925b07c5845d5e82f4053e2e95929d5854a53c18527c414506d661c6480a0f33988551c27c2d12a2365b697667547c5c
7
+ data.tar.gz: eef887147dab118aa9665d1857ad0e5314101e8de87be8944c2ee5bc5ffd1fa3551605f87651f4ac7a6b6ad05aa219899f36ed8b81b2793bf91370448711626f
data/Changelog.md CHANGED
@@ -1,3 +1,10 @@
1
+ 1.0.1 (2021-08-18)
2
+ ------------------
3
+
4
+ * Added validation if domain name is a string
5
+
6
+ * Added test for minimum levels
7
+
1
8
  1.0 (2021-08-18)
2
9
  ----------------
3
10
 
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
- $ gem build domain_name_validator.gemspec
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
- $ gem push domain_name_validator.gem
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
@@ -51,6 +51,8 @@ module DomainNameFormatValidator
51
51
  if domain.nil?
52
52
  errs << ERRS[:zero_size]
53
53
  else
54
+ return [ERRS[:not_a_string]] unless domain.is_a? String
55
+
54
56
  domain = domain.strip
55
57
  errs << ERRS[:zero_size] if domain.size.zero?
56
58
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DomainNameFormatValidator
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: domain_name_format_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Keener