email_address 0.2.7 → 0.2.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09a47fb94c722c1b77e1b88f60eb9b275c10b0af362b7e951688b16edb8b8956'
4
- data.tar.gz: 518cd6502197567e1819218bff259a596eae8d5521d89c69a4dd3d691047b04a
3
+ metadata.gz: f3e705bb2a1c36387985e1a57fef60ba6eac15c19a540a9383bd04f99faf14b8
4
+ data.tar.gz: 48745aa6d978faf2786dc56ffdddced88443d2c379416e5a5073103920ea23c4
5
5
  SHA512:
6
- metadata.gz: ed80c20ef002dca0ec0280e2a3e418b4f77811dcac90ee338e186a39b88151817aed715e5cf50aea20755fcd1a3aec5df7dba9ed4381d540da861b51a33c1326
7
- data.tar.gz: 387e799ca2eef4de99232f36d2a8be0bcc69d3616d49cb2f499c856595c6abb2ac7ae02b9d9d5c3b667356a645700ffc03a59124997daa00354d22b22d26d29d
6
+ metadata.gz: b95ec709cd052735908f4d2a5fd9605ac86e1293331c47eeb1c6b8901b65b0567298fa85dc1382d8821fefa065e91e76797b63b7c1f863002eabd90a76b8eaa1
7
+ data.tar.gz: 1d97b8c973a279f5c62f1959eab5d594275cf441e31ffca3b53bd44081fef77586e30bc9da8b5d351fd40a72c475c7bccae664de91ece9d161c24b64bcc56bbe
@@ -5,7 +5,7 @@ jobs:
5
5
  runs-on: ubuntu-latest
6
6
  strategy:
7
7
  matrix:
8
- ruby-version: [3.2, 3.3, 3.4]
8
+ ruby-version: [3.2, 3.3, 3.4, 4.0]
9
9
  steps:
10
10
  - uses: actions/checkout@v3
11
11
  - uses: ruby/setup-ruby@v1
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = "https://github.com/afair/email_address"
13
13
  spec.license = "MIT"
14
14
 
15
- spec.required_ruby_version = ">= 2.5", "< 4"
15
+ spec.required_ruby_version = ">= 2.5", "< 5.0"
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
@@ -34,6 +34,11 @@ module EmailAddress
34
34
  end
35
35
  end
36
36
 
37
+ # Has any MX records?
38
+ def exist?
39
+ count > 0
40
+ end
41
+
37
42
  # Returns the provider name based on the MX-er host names, or nil if not matched
38
43
  def provider
39
44
  return @provider if defined? @provider
@@ -332,6 +332,10 @@ module EmailAddress
332
332
  @_dns_a_record ||= []
333
333
  end
334
334
 
335
+ def dns_a_record_exist?
336
+ dns_a_record.size > 0
337
+ end
338
+
335
339
  # Returns an array of Exchanger hosts configured in DNS.
336
340
  # The array will be empty if none are configured.
337
341
  def exchangers
@@ -404,7 +408,7 @@ module EmailAddress
404
408
  # True if the host name has a DNS A Record
405
409
  def valid_dns?
406
410
  return true unless dns_enabled?
407
- dns_a_record.size > 0 || set_error(:domain_unknown)
411
+ dns_a_record_exist? || exchangers.exist? || set_error(:domain_unknown)
408
412
  end
409
413
 
410
414
  # True if the host name has valid MX servers configured in DNS
@@ -357,8 +357,8 @@ module EmailAddress
357
357
  # True if the part matches the RFC standard format
358
358
  def standard?
359
359
  self.syntax = :invalid
360
- return false unless STANDARD_LOCAL_REGEX.match?(local)
361
360
  return false unless valid_size?
361
+ return false unless STANDARD_LOCAL_REGEX.match?(local)
362
362
  return false unless valid_encoding?
363
363
  self.syntax = :standard
364
364
  true
@@ -1,3 +1,3 @@
1
1
  module EmailAddress
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
@@ -166,4 +166,8 @@ class TestHost < MiniTest::Test
166
166
  def test_triple_dash_domain
167
167
  assert EmailAddress::Host.new("off---white.com").valid?
168
168
  end
169
+
170
+ def test_mx_only_domain
171
+ assert EmailAddress::Host.new("mail.usqrl.com").valid?
172
+ end
169
173
  end
@@ -102,15 +102,12 @@ class TestLocal < MiniTest::Test
102
102
  assert EmailAddress.valid?("username_____@gmail.com")
103
103
  end
104
104
 
105
- def test_tag_punctuation
106
- assert EmailAddress.valid?("first.last+foo.bar@gmail.com")
107
- end
108
-
109
105
  def test_relaxed_tag
110
106
  assert EmailAddress.valid? "foo+abc@example.com", host_validation: :syntax, local_format: :relaxed
111
107
  end
112
108
 
113
109
  def test_tag_punctuation
110
+ assert EmailAddress.valid?("first.last+foo.bar@gmail.com")
114
111
  refute EmailAddress.valid?("name+tag.@domain.com", host_validation: :syntax)
115
112
  assert EmailAddress.valid?("name+tag.-@domain.com", host_validation: :syntax, local_format: :relaxed)
116
113
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_address
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Allen Fair
@@ -256,14 +256,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
256
256
  version: '2.5'
257
257
  - - "<"
258
258
  - !ruby/object:Gem::Version
259
- version: '4'
259
+ version: '5.0'
260
260
  required_rubygems_version: !ruby/object:Gem::Requirement
261
261
  requirements:
262
262
  - - ">="
263
263
  - !ruby/object:Gem::Version
264
264
  version: '0'
265
265
  requirements: []
266
- rubygems_version: 3.6.9
266
+ rubygems_version: 4.0.3
267
267
  specification_version: 4
268
268
  summary: This gem provides a ruby language library for working with and validating
269
269
  email addresses. By default, it validates against conventional usage, the format