peter-mueller 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.rdoc +5 -0
- data/lib/peter-mueller/company.rb +1 -0
- data/lib/peter-mueller/email.rb +23 -17
- data/lib/peter-mueller/version.rb +1 -1
- metadata +7 -7
data/HISTORY.rdoc
CHANGED
data/lib/peter-mueller/email.rb
CHANGED
@@ -11,22 +11,22 @@ module PeterMueller
|
|
11
11
|
# Creates a new email address.
|
12
12
|
def initialize(person = Person.new, owndomain = (rand(1..50) == 2))
|
13
13
|
if owndomain
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
[
|
15
|
+
lambda{ user_from_names(person) },
|
16
|
+
lambda{ user_from_firstname(person, "") },
|
17
|
+
lambda{ user_from_initials(person, "") },
|
18
|
+
].sample.call
|
19
19
|
|
20
20
|
@host = [
|
21
|
-
|
21
|
+
from_names(person),
|
22
22
|
TLD.sample,
|
23
23
|
].join(".")
|
24
24
|
else
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
[
|
26
|
+
lambda{ user_from_names(person) },
|
27
|
+
lambda{ user_from_firstname(person) },
|
28
|
+
lambda{ user_from_initials(person) },
|
29
|
+
].sample.call
|
30
30
|
|
31
31
|
@host = FREEMAIL_PROVIDER.sample
|
32
32
|
end
|
@@ -48,24 +48,30 @@ module PeterMueller
|
|
48
48
|
gsub("ß","ss")
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
# Generates the user-part from the names of a Person.
|
52
52
|
def user_from_names(person, sepchar=["","_","."].sample)
|
53
|
-
|
54
|
-
part2 = self.class.umlautfix(person.lastname).gsub(/[^a-zA-Z]/,"").downcase
|
55
|
-
"#{part1}#{sepchar}#{part2}"
|
53
|
+
@user = from_names(person, sepchar)
|
56
54
|
end
|
57
55
|
|
56
|
+
# Generates the user-part from the firstname and a number.
|
58
57
|
def user_from_firstname(person, number = rand(1..9999).to_s)
|
59
58
|
part = self.class.umlautfix(person.firstname).gsub(/[^a-zA-Z]/,"").downcase
|
60
|
-
"#{part}#{number}"
|
59
|
+
@user = "#{part}#{number}"
|
61
60
|
end
|
62
61
|
|
62
|
+
# Generates the user-part from the initials and a number.
|
63
63
|
def user_from_initials(person, number = rand(1..9999).to_s)
|
64
64
|
part1 = self.class.umlautfix(person.firstname).gsub(/[^a-zA-Z]/,"").downcase
|
65
65
|
part2 = self.class.umlautfix(person.lastname).gsub(/[^a-zA-Z]/,"").downcase
|
66
|
-
"#{part1[0]}#{part2[0]}#{number}"
|
66
|
+
@user = "#{part1[0]}#{part2[0]}#{number}"
|
67
67
|
end
|
68
68
|
|
69
|
+
private
|
70
|
+
def from_names(person, sepchar=["","_","."].sample)
|
71
|
+
part1 = self.class.umlautfix(person.firstname).gsub(/[^a-zA-Z]/,"").downcase
|
72
|
+
part2 = self.class.umlautfix(person.lastname).gsub(/[^a-zA-Z]/,"").downcase
|
73
|
+
"#{part1}#{sepchar}#{part2}"
|
74
|
+
end
|
69
75
|
end
|
70
76
|
|
71
77
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peter-mueller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-05-03 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &20824180 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.2
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *20824180
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &20823600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '2.9'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *20823600
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: ZenTest
|
38
|
-
requirement: &
|
38
|
+
requirement: &20822980 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 4.7.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *20822980
|
47
47
|
description: ! "A library for creating fictitious German address data.\n The
|
48
48
|
addresses look real, though they are of pure random and fictitious origin."
|
49
49
|
email:
|