emailist 0.0.13 → 0.0.14

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
  SHA1:
3
- metadata.gz: af803bb2dda4fe80191c96fa40d8b2934fb7a959
4
- data.tar.gz: 6ca0e667e90bc8638f42cab15c869a9e3d3de3dc
3
+ metadata.gz: ea9eab6bff1e9e25048b41d223021e6cb26365e7
4
+ data.tar.gz: 6012cf99e4fb5e8454da3828c5690618a9cc73aa
5
5
  SHA512:
6
- metadata.gz: b5f960339fd5f79cf7d650e42d9e0ea616e38a214d95db1f25bf09a4bfbf0e1cc6f0dd42112cc8b248ae00c5c07ae99412a78903cd1cef379bf9ae9fc3f5f0cc
7
- data.tar.gz: d18145f2984e557dc7699ed1e51402b4adaa90c57e359ecd38c6006dd0812791b8b4afe12b157dc481371487dec376c060c404ffc5762a4e9d4b5b87e601aa0b
6
+ metadata.gz: 2152ad37f6adfae9608551af94e6825f88d762b6092bd1086a01e8b7c9ba7d62c78bdfdd3c2a0bdd6832aa245da0ef1f9094033575d43f861fe28823dd6454a4
7
+ data.tar.gz: 2ded1d96588586da8d0340de69c293ff9838e7c94f03118ac1320187e28b7617146e6b83f675e1c18a9855ba4c99710877cce867ddb9d0171f7f217157af95eb
@@ -1,3 +1,3 @@
1
1
  class Emailist < Array
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
data/lib/emailist.rb CHANGED
@@ -154,26 +154,27 @@ private
154
154
  return true if live_hosts.include?(domain)
155
155
  return false if dead_hosts.include?(domain)
156
156
 
157
+ result = false # assume the host is dead
158
+
157
159
  resolv = Resolv::DNS.new(
158
160
  nameserver: ['8.8.8.8'],
159
161
  search: [],
160
162
  ndots: 1
161
163
  )
162
164
  ip_addr = begin
163
- resolv.getaddress(domain)
165
+ resolv.getaddress(domain).to_s
164
166
  rescue Resolv::ResolvError
165
167
  end
166
168
  dns_result = ip_addr ? true : false
167
169
 
168
- ping_result = if live_hosts.include?(domain)
169
- true
170
- elsif dead_hosts.include?(domain)
171
- false
172
- else
173
- Net::Ping::External.new(domain).ping?
174
- end
170
+ if dns_result
171
+ ping_result = Net::Ping::External.new(ip_addr).ping
172
+
173
+ if ping_result
174
+ result = true
175
+ end
176
+ end
175
177
 
176
- result = (dns_result || ping_result)
177
178
  if result
178
179
  live_hosts.push(domain)
179
180
  live_hosts.uniq!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emailist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan Barron