mail_box_validator 0.9.0 → 1.0.0

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
  SHA1:
3
- metadata.gz: b4dfe300c33d9814590f119f978dd32c7ef4e630
4
- data.tar.gz: c61cbfba40995c3ac6ecccbe803e6524abcbd5ad
3
+ metadata.gz: 4ae86132c9970aaa61ea82e0126026288e625b72
4
+ data.tar.gz: de0671e7e99b868f92aa181df9a4e99294650ba6
5
5
  SHA512:
6
- metadata.gz: 9514b1ee70388e43bdc30f6f839b3e328e9c4acafc77a13cdfe1bc4c63d1d45fa4d0b583f3c3f5966f0530b2adc970413246984b701b1818c16ab4a324e2383e
7
- data.tar.gz: 8950c6565d3d5297a29e19fecaafc466222fff30177a77100a35c7864b0cb117d713ddd63749f16dee4d2009ca580392d9415fb68507add3dcca0c8085b0fe1c
6
+ metadata.gz: e0952e9fa21bd3b4b50b1baa4dda2a6f3e1c3ed1689da7400e0db2ece387e0c5c8fa1ec54af111b089c74bd0e771bfe09bd2cb77a027a60fe9c00f5e337a0511
7
+ data.tar.gz: 70bc03d759ded9f943a7cc24dab443584092c222a793781b76abfca0dcd451036055364a73f64727c4979f5c63301e83af6a683920760412d3833c3f6191ff67
data/README.md CHANGED
@@ -18,7 +18,7 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ MailBoxValidator::MailBox.instance.valid?(mail_address)
22
22
 
23
23
  ## Contributing
24
24
 
@@ -7,12 +7,17 @@ module MailBoxValidator
7
7
  def valid?(mail_address)
8
8
  domain = mail_address.slice(/@(.*)/, 1)
9
9
  mx = mail_exchanger_record_for(domain)
10
- return false unless mx.present?
11
- mx.all? {|host| response_for(mail_address, host).match(/^2\d{2}/).present? }
10
+ mx.present? && mx.all?(&return_valid?)
12
11
  end
13
12
 
14
13
  private
15
14
 
15
+ def return_valid?
16
+ Proc.new do |host|
17
+ response_for(mail_address, host).match(/^2\d{2}/).present?
18
+ end
19
+ end
20
+
16
21
  def response_for(mail_address, host)
17
22
  response = ''
18
23
  telnet = Net::Telnet::new(
@@ -1,3 +1,3 @@
1
1
  module MailBoxValidator
2
- VERSION = "0.9.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail_box_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bidu Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-06 00:00:00.000000000 Z
11
+ date: 2015-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler