rich_email_validator 0.0.1 → 0.0.2

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: 342b23a6f90fe7e83ee17b5c4d359c9bbc06cb69
4
- data.tar.gz: 68036edb2fbff383bd50ee82b238b89ea445044b
3
+ metadata.gz: fee79c5bfc11ac5a00d767398d2163103eb4fd76
4
+ data.tar.gz: 585c9285b557492149f9ec2d205ff39e1d15aa59
5
5
  SHA512:
6
- metadata.gz: f5a82bca84c3d7b9b5e23cdfd7e486e4089e2da26c318cb55f0684c8ded936d0c44b1b796c74127e2d49ebdce6bb592cbbfef2991f493fc17678158fa96454d4
7
- data.tar.gz: 9990e019cc24483513138ca10a6d67733bd8fd1141158c00aa7674d7b580d71ca2da8f4ce0bb30ea75630d564741bc588dc04cb5ef0712e2279f9e45934d29e3
6
+ metadata.gz: d9027a6cda51663ee8e45938787316ed8059552ea2aa225b4cfe482f2203942fec9b88cad84a1c7c6f455a7050f5e270c2495c953904a435ca54e5ff6e853247
7
+ data.tar.gz: 4202f88c0be393c011c91ea07c4ddc10838f3b65f83b14a7d9bfbcb4284ec07aaf01432569750b07ebf8200ce112b14c9fffef0023e54e089686fef1e7482e70
@@ -1,7 +1,6 @@
1
1
  bundler_args: --without development
2
2
  language: ruby
3
3
  rvm:
4
- - 1.9.2
5
4
  - 1.9.3
6
5
  - 2.0.0
7
6
  - 2.1
@@ -16,7 +15,8 @@ matrix:
16
15
  - rvm: jruby-head
17
16
  env: JRUBY_OPTS="$JRUBY_OPTS --debug"
18
17
  allow_failures:
18
+ - rvm: jruby-19mode
19
19
  - rvm: jruby-head
20
20
  - rvm: rbx-2
21
21
  - rvm: ruby-head
22
- fast_finish: true
22
+ fast_finish: true
data/Guardfile CHANGED
@@ -1,7 +1,5 @@
1
1
  guard 'rspec' do
2
2
  watch(%r{^spec/.+_spec\.rb$})
3
- watch(%r{^spec/gateway/.+_spec\.rb$})
4
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/feedlr/#{m[1]}_spec.rb" }
5
- watch(%r{^lib/gateway/(.+)\.rb$}) { |m| "spec/feedlr/gateway/#{m[1]}_spec.rb" }
3
+ watch(%r{^lib/(.+)\.rb$}){ |m| "spec/rich_email_validator/#{m[1]}_spec.rb" }
6
4
  watch('spec/helper.rb') { "spec" }
7
5
  end
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- # RichEmailValidator
1
+ # Rich Email Validator
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/rich_email_validator.svg)](http://badge.fury.io/rb/rich_email_validator) [![Build Status](https://travis-ci.org/Startappz/rich_email_validator.svg?branch=master)](https://travis-ci.org/Startappz/rich_email_validator) [![Coverage Status](https://coveralls.io/repos/Startappz/rich_email_validator/badge.png)](https://coveralls.io/r/Startappz/rich_email_validator) [![Dependency Status](https://gemnasium.com/Startappz/rich_email_validator.svg)](https://gemnasium.com/Startappz/rich_email_validator) [![Code Climate](https://codeclimate.com/github/Startappz/rich_email_validator/badges/gpa.svg)](https://codeclimate.com/github/Startappz/rich_email_validator)
2
4
 
3
5
  A set of helpers to validate emails:
4
6
 
@@ -34,7 +36,7 @@ Or install it yourself as:
34
36
  ```ruby
35
37
  require 'rich_email_validator'
36
38
  RichEmailValidator.valid_email?('khellls@gmail.com') # => true
37
- RichEmailValidator.valid_email?('khellls@g.com') # => false because DNS lookup check
39
+ RichEmailValidator.valid_email?('khellls@g.com') # => false because of DNS lookup check
38
40
  ```
39
41
  ### Set a predfined Regexp
40
42
 
@@ -61,7 +63,7 @@ list = ['khellls@g.com', 'khellls@gmail.com']
61
63
  RichEmailValidator.filter_list(list) #=> ["khellls@gmail.com"]
62
64
 
63
65
  # You have a fine grained control, so you can control threads count
64
- # Default is 20
66
+ # Default is 20, max 100
65
67
  RichEmailValidator.filter_list(list, threads_count: 15)
66
68
 
67
69
  ```
@@ -74,7 +76,7 @@ File.readlines(file_path).size #=> 15
74
76
  RichEmailValidator.filter_file(file_path).size #=> 10
75
77
 
76
78
  # You have a fine grained control, so you can control threads count
77
- # Default is 20
79
+ # Default is 20, max 100
78
80
  RichEmailValidator.filter_file(file_path, threads_count: 15)
79
81
 
80
82
  ```
@@ -89,7 +91,7 @@ RichEmailValidator.export_valid_list(file_path, output_path)
89
91
  File.readlines('output.txt').size #=> 10
90
92
 
91
93
  # You have a fine grained control, so you can control threads count
92
- # Default is 20
94
+ # Default is 20, max 100
93
95
  RichEmailValidator.export_valid_list(file_path, output_path, threads_count: 15)
94
96
 
95
97
  ```
@@ -18,7 +18,11 @@ module RichEmailValidator
18
18
 
19
19
  def default_email_regexp
20
20
  @default_email_regexp ||=
21
- /\A[\w!#$%&'*+\/=?`{|}~^-]+(?:\.[\w!#$%&'*+\/=?`{|}~^-]+)*@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\Z/i
21
+ %r{
22
+ \A[\w!#$%&'*+/=?`{|}~^-]+
23
+ (?:\.[\w!#$%&'*+/=?`{|}~^-]+)*
24
+ @(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\Z
25
+ }ix
22
26
  end
23
27
  end
24
28
 
@@ -8,7 +8,7 @@ module RichEmailValidator
8
8
  # @param input_file_path [File]
9
9
  # @param [Hash] options
10
10
  # @option options [#to_int] :threads_count number of threads that will
11
- # be fired simultaneously to calculate the result
11
+ # be fired simultaneously to calculate the result. Default 20, max 100
12
12
  # @return [Array]
13
13
  def filter(input_file_path, options = {})
14
14
  new(input_file_path, options).filter
@@ -19,7 +19,7 @@ module RichEmailValidator
19
19
  # @param output_file_path [File]
20
20
  # @param [Hash] options
21
21
  # @option options [#to_int] :threads_count number of threads that will
22
- # be fired simultaneously to calculate the result
22
+ # be fired simultaneously to calculate the result. Default 20, max 100
23
23
  def export_valid_list(input_file_path, output_file_path, options = {})
24
24
  new(input_file_path, options).export_valid_list(output_file_path)
25
25
  end
@@ -29,7 +29,7 @@ module RichEmailValidator
29
29
  # @param input_file_path [File]
30
30
  # @param [Hash] options
31
31
  # @option options [#to_int] :threads_count number of threads that will
32
- # be fired simultaneously to calculate the result
32
+ # be fired simultaneously to calculate the result. Default 20, max 100
33
33
  def initialize(input_file_path, options = {})
34
34
  @input_file_path = input_file_path
35
35
  @options = options
@@ -9,7 +9,7 @@ module RichEmailValidator
9
9
  # @param list [Enumerator]
10
10
  # @param [Hash] options
11
11
  # @option options [#to_int] :threads_count number of threads that will
12
- # be fired simultaneously to calculate the result
12
+ # be fired simultaneously to calculate the result. Default 20, max 100
13
13
  # @return [Array]
14
14
  def filter(list, options = {})
15
15
  new(list, options).filter
@@ -22,10 +22,11 @@ module RichEmailValidator
22
22
  # @param list [Enumerator]
23
23
  # @param [Hash] options
24
24
  # @option options [#to_int] :threads_count number of threads that will
25
- # be fired simultaneously to calculate the result
25
+ # be fired simultaneously to calculate the result. Default 20, max 100
26
26
  def initialize(list, options = {})
27
27
  @list = list
28
28
  @threads_count = options.fetch(:threads_count) { 20 }
29
+ fail ArgumentError, "Threads can't exceed 100" if @threads_count > 100
29
30
  @result = []
30
31
  @total_slices = (@list.size / @threads_count.to_f).ceil
31
32
  end
@@ -55,6 +56,11 @@ module RichEmailValidator
55
56
  email = list[list_index]
56
57
  result[list_index] = email if EmailValidator.valid?(email)
57
58
  end
59
+ sleep_timer(start_index)
60
+ end
61
+
62
+ def sleep_timer(index)
63
+ sleep(1) if (index % ((100 / threads_count) * threads_count)) == 0
58
64
  end
59
65
  end
60
66
  end
@@ -3,7 +3,7 @@ module RichEmailValidator
3
3
  class Version
4
4
  MAJOR = 0
5
5
  MINOR = 0
6
- PATCH = 1
6
+ PATCH = 2
7
7
 
8
8
  class << self
9
9
  # @return [String]
@@ -8,11 +8,11 @@ Gem::Specification.new do |gem|
8
8
  gem.version = RichEmailValidator::Version
9
9
  gem.authors = ["Khaled alHabache"]
10
10
  gem.email = ["khellls@gmail.com"]
11
- gem.summary = %q{Set of helpers to validate emails}
12
- gem.description = %q{Set of helpers to validate emails}
11
+ gem.summary = %q{Set of rich helpers for email validation}
12
+ gem.description = %q{Set of rich helpers for email validation}
13
13
  gem.homepage = "https://github.com/Startappz/rich_email_validator"
14
14
  gem.license = 'LGPL-3'
15
- gem.required_ruby_version = '>= 1.9.2'
15
+ gem.required_ruby_version = '>= 1.9.3'
16
16
  gem.files = `git ls-files`.split($/)
17
17
  gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  gem.test_files = Dir.glob('spec/**/*')
@@ -1,3 +1,17 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
+ SimpleCov::Formatter::HTMLFormatter,
7
+ Coveralls::SimpleCov::Formatter
8
+ ]
9
+
10
+ SimpleCov.start do
11
+ add_filter '/spec/'
12
+ minimum_coverage(95)
13
+ end
14
+
1
15
  require_relative '../lib/rich_email_validator'
2
16
 
3
17
  # This file was generated by the `rspec --init` command. Conventionally, all
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rich_email_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Khaled alHabache
@@ -10,7 +10,7 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2014-08-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Set of helpers to validate emails
13
+ description: Set of rich helpers for email validation
14
14
  email:
15
15
  - khellls@gmail.com
16
16
  executables: []
@@ -53,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 1.9.2
56
+ version: 1.9.3
57
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -64,7 +64,7 @@ rubyforge_project:
64
64
  rubygems_version: 2.4.1
65
65
  signing_key:
66
66
  specification_version: 4
67
- summary: Set of helpers to validate emails
67
+ summary: Set of rich helpers for email validation
68
68
  test_files:
69
69
  - spec/fixtures/list_fixture.txt
70
70
  - spec/fixtures/valid_fixture.txt