mailMapper 0.1.0 → 0.1.2

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: 5b1716497b0d12cae227baa3be988a0089bec125
4
- data.tar.gz: 81afba2fe9046e63d3e5623edd8e48f83d40bdde
3
+ metadata.gz: 7ce6c9e8e1e25984560d9c7a0ba2fa8e4dcfd567
4
+ data.tar.gz: 1760c74a2da0377747501f409661ab9a9d1923ed
5
5
  SHA512:
6
- metadata.gz: 5a27c6ed4dc87301c545e1ac1b128f9a24f8e89232b9b0a069e151cc0a12a8ed3a1089b5df559d65ef22a767e9b7e4c6e04f5022ba0bcba868e111c92115b15e
7
- data.tar.gz: ca536d5fd0bdd4e0b0270a83107aa4951c7c920429e71852bca68ea898cae2fe6ed7cbd512b7ae39333d812a5721225a57332b0b72cdae3d65176d26b4e5523c
6
+ metadata.gz: 4433491588236ac71da12a12f7b90fb6de82ec48eacafcea6f4d7b90b957e761c103ec90dc09f16f3fb211ab1e5d188ec5f603d370dc09aab6a3025e5e80d1c1
7
+ data.tar.gz: 335106e5f6dc6daaf4b58c7706f9acafd8bff070966f714afc8a70728fc21f33ceed8bc5bece98bc327906ad777a305d47943e428eac940027c0749f593696d1
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /mailMapper-0.1.0.gem/
data/lib/mailMapper.rb CHANGED
@@ -1,22 +1,23 @@
1
1
  require "mailMapper/version"
2
2
 
3
3
  module MailMapper
4
- require 'json'
4
+ require 'json'
5
5
 
6
- def mailMapper(path, option = 0)
6
+ def self.find(path=" ", option = 0)
7
7
  text=File.open(path).read
8
8
  if option == 0
9
- @mails = mapMails(text)
10
- return reduceMails(@mails)
9
+ mails = mapMails(text)
10
+ return reduceMails(mails)
11
11
  elsif option == 1
12
+ mails = mapMails(text)
13
+ return mails.each_with_object(Hash.new(0)) { |mail,counts| counts[mail] += 1 }
14
+ elsif option == 2
12
15
  mails = mapMails(text)
13
16
  return mapMails(text)
14
- elsif option ==2
15
- return mails.each_with_object(Hash.new(0)) { |mail,counts| counts[mail] += 1 }
16
17
  end
17
18
  end
18
19
 
19
- def mapMails(text=text)
20
+ def self.mapMails(text)
20
21
  mails = []
21
22
  #Map text
22
23
  line_num=0
@@ -28,7 +29,7 @@ def mapMails(text=text)
28
29
  return mails
29
30
  end
30
31
 
31
- def reduceMails(mails=@mails)
32
+ def self.reduceMails(mails=@mails)
32
33
  mailExt = []
33
34
  mapHash = {}
34
35
  domain = ""
@@ -42,7 +43,6 @@ def reduceMails(mails=@mails)
42
43
  mapHash[domain] += 1
43
44
  end
44
45
  }
45
- puts @r
46
46
  return @r
47
47
  end
48
48
  end
@@ -1,3 +1,3 @@
1
1
  module MailMapper
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
Binary file
data/mailMapper.gemspec CHANGED
@@ -10,17 +10,17 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["oscaryunue@gmail.com"]
11
11
 
12
12
  spec.summary = %q{Map mails from text files and count occurrences}
13
- spec.description = %q{Search and count emails from a text file, Ex. mailMapper("source", option=int); option 0 «default value» returns a hash with domain-key counter-value, option 1 returns a hash for user ocuurenciues, option 2 returns an array with all mails }
13
+ spec.description = %q{Search and count emails from a text file, Ex. MailMapper.find("source", option=int); option 0 «default value» returns a hash with domain-key counter-value, option 1 returns a hash for user@mail -> counter-value, option 2 returns an array with all mails }
14
14
  spec.homepage = "https://rubygems.org/profiles/oscaryunue"
15
15
  spec.license = "MIT"
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
18
  # delete this section to allow pushing this gem to any host.
19
- if spec.respond_to?(:metadata)
20
- spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
- else
22
- raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
- end
19
+ #if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ #else
22
+ # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ #end
24
24
 
25
25
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
26
  spec.bindir = "exe"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailMapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - oscaryunue
@@ -14,56 +14,57 @@ dependencies:
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.11'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
- description: 'Search and count emails from a text file, Ex. mailMapper("source", option=int);
56
- option 0 «default value» returns a hash with domain-key counter-value, option 1
57
- returns a hash for user ocuurenciues, option 2 returns an array with all mails '
55
+ description: 'Search and count emails from a text file, Ex. MailMapper.find("source",
56
+ option=int); option 0 «default value» returns a hash with domain-key counter-value,
57
+ option 1 returns a hash for user@mail -> counter-value, option 2 returns an array
58
+ with all mails '
58
59
  email:
59
60
  - oscaryunue@gmail.com
60
61
  executables: []
61
62
  extensions: []
62
63
  extra_rdoc_files: []
63
64
  files:
64
- - .gitignore
65
- - .rspec
66
- - .travis.yml
65
+ - ".gitignore"
66
+ - ".rspec"
67
+ - ".travis.yml"
67
68
  - CODE_OF_CONDUCT.md
68
69
  - Gemfile
69
70
  - LICENSE.txt
@@ -73,29 +74,29 @@ files:
73
74
  - bin/setup
74
75
  - lib/mailMapper.rb
75
76
  - lib/mailMapper/version.rb
77
+ - mailMapper-0.1.0.gem
76
78
  - mailMapper.gemspec
77
79
  homepage: https://rubygems.org/profiles/oscaryunue
78
80
  licenses:
79
81
  - MIT
80
- metadata:
81
- allowed_push_host: 'TODO: Set to ''http://mygemserver.com'''
82
+ metadata: {}
82
83
  post_install_message:
83
84
  rdoc_options: []
84
85
  require_paths:
85
86
  - lib
86
87
  required_ruby_version: !ruby/object:Gem::Requirement
87
88
  requirements:
88
- - - '>='
89
+ - - ">="
89
90
  - !ruby/object:Gem::Version
90
91
  version: '0'
91
92
  required_rubygems_version: !ruby/object:Gem::Requirement
92
93
  requirements:
93
- - - '>='
94
+ - - ">="
94
95
  - !ruby/object:Gem::Version
95
96
  version: '0'
96
97
  requirements: []
97
98
  rubyforge_project:
98
- rubygems_version: 2.0.14.1
99
+ rubygems_version: 2.5.1
99
100
  signing_key:
100
101
  specification_version: 4
101
102
  summary: Map mails from text files and count occurrences